Watch a programming language work.
A small, hand-rolled language — tokenize, parse, execute, compile to bytecode — with every step animated in front of you. ~25,000 lines, no exec(), no compile-to-Python.
1i = 12while (i <= 3) {3 if (i == 3) {4 coutln("Fizz")5 } else {6 coutln(i)7 }8 i = i + 19}
The pipeline
Six stages, from raw characters to printed output. The playground animates every one of them.
Watch each stage
Self-contained loops, one per major pipeline stage. The full playground threads them together.
- 0 LOAD_CONST 42
- 1 STORE_NAME i
- 2 LOAD_NAME i
- 3 RETURN
What's inside
The whole language lives in six files. Each one is small enough to read in a sitting.
Hand-rolled, char-by-char tokenizer. Emits Tokens with line + col.
Recursive-descent statements; Pratt expressions. Builds the AST.
Tree-walking evaluator. Snapshot-per-statement for the playground's step mode.
AST → bytecode chunks. The M2 compiler. Per-instruction line attribution.
Stack-based bytecode VM. Frames, handlers, 38 opcodes.
RotError + rustc-style rendering — source line, caret, hints.
Demos
Open a sample in the playground and step through it statement by statement.