Free tools & games for everyone
Free · No sign-up · No accounts
See a tiny language compiled stage by stage: tokens, syntax tree, stack machine code with constant folding, then run it and see the output.
| Tab | Move between the menu, the program box and the button (inside the box, Tab moves on rather than typing a tab) |
|---|---|
| Enter | On the button: compile and run |
The scanner is a single pattern loop; the parser is a hand-written recursive descent parser with one function per precedence level, the way many real compilers start. The code generator walks the tree and writes stack instructions (PUSH, LOAD, STORE, ADD ... NE, NEG, JMP, JZ, PRINT, HALT); constant folding works out any part of an expression made only of numbers before code is written. Numbers are 32-bit whole numbers that wrap around. A program may run at most 200,000 steps and print 1,000 lines.
The language is a small teaching language, not a real one. Everything runs in your browser.
A fresh daily puzzle every morning, and new tools added every month.
Browse every product