explaingit

tomekw/stcc

Analysis updated 2026-06-24

23AdaAudience · developerComplexity · 2/5Setup · moderate

TLDR

Ada rewrite of Jamie Kyle's Super Tiny Compiler that turns Lisp-style expressions like (add 2 (subtract 4 2)) into C-style function calls add(2, subtract(4, 2)) through tokenizer, parser, transformer, and code generator stages.

Mindmap

mindmap
  root((stcc))
    Inputs
      Lisp style expression
    Outputs
      C style function call string
    Use Cases
      Learn compiler stages
      Practice Ada
      Read a tiny parser
    Tech Stack
      Ada
      Tada
    Stages
      Tokenizer
      Parser
      Transformer
      Code Generator
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Read a small Ada codebase to learn how tokenizer, parser, transformer, and code generator fit together

USE CASE 2

Compare the Ada port against Jamie Kyle's original JavaScript Super Tiny Compiler

USE CASE 3

Extend stcc with a new operator beyond add and subtract

USE CASE 4

Use stcc as a reference project when picking up Ada and the Tada build tool

What is it built with?

AdaTada

How do you get it running?

Difficulty · moderate Time to first run · 30min

Building from source needs an Ada toolchain plus the Tada build tool which is unfamiliar to most non-Ada developers.

In plain English

STCC is an Ada rewrite of Jamie Kyle's well known teaching project, The Super Tiny Compiler. The original is a short JavaScript codebase that walks the reader through the parts every compiler has, namely a tokenizer, a parser, a transformer, and a code generator. This repository takes that same exercise and reimplements it in Ada. The input language is tiny. You write something that looks like a Lisp expression, for example (add 2 (subtract 4 2)), and the compiler turns it into a function call in the style of C or JavaScript, for example add(2, subtract(4, 2)). That conversion is the whole job of the program. There are no variables, control flow, types, or other compiler concerns. The README shows two ways to run it. From a built release you can execute the stcc binary directly and feed it an expression. If you have Tada installed, which is an Ada build and package tool the README links to at tada.pm, you can use tada run instead, and tada test to run the test suite. The README is intentionally short. The author has added one note at the bottom that says the codebase was written by hand, which is a small but pointed remark given how much code these days is produced by AI tools. Beyond that, there is no license text, no architecture write up, and no installation guide for Ada itself in the README. The repository topics list it as Ada, compiler, parser, code generation, and programming language theory.

Copy-paste prompts

Prompt 1
Walk me through how stcc tokenizes the input (add 2 (subtract 4 2)) step by step
Prompt 2
Add support for multiply and divide operators to stcc and update the test suite
Prompt 3
Compare stcc's Ada code structure to the JavaScript original of The Super Tiny Compiler
Prompt 4
Show me a tada run command that pipes a Lisp expression into stcc and prints the C style output
Prompt 5
Patch stcc to also emit Python style function calls alongside the C style ones

Frequently asked questions

What is stcc?

Ada rewrite of Jamie Kyle's Super Tiny Compiler that turns Lisp-style expressions like (add 2 (subtract 4 2)) into C-style function calls add(2, subtract(4, 2)) through tokenizer, parser, transformer, and code generator stages.

What language is stcc written in?

Mainly Ada. The stack also includes Ada, Tada.

How hard is stcc to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is stcc for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.