A Lisp interpreter
Tokenizer, parser, evaluator and closures. Discover how a language runs your code, step by step.
Python · JavaScript · TypeScript
From source code to runnable bytecode. Lexing, AST, semantic analysis, code generation and a VM that runs it.
Build it in your language
The tester treats your program as a black box: any language works. These are just the most convenient ones for this project.
This is the longest challenge in the catalog and the one that brings the most together: your own language, with its compiler and its virtual machine, built end to end.
You'll go from text to tokens, from tokens to a tree, from the tree to a type-checked representation, from there to bytecode and, finally, to a stack machine that executes it. You'll finish running programs written in a language you designed yourself.
16 stages across 4 phases. Every stage comes with its guide and its tests: you move on when they pass.
Lexer, a parser with precedence, and the language's syntax tree.
Name resolution, scopes, type checking and useful errors.
Instruction set, constants, jumps, and compiling the tree.
Stack virtual machine, call frames, functions and optimisations.
Tokenizer, parser, evaluator and closures. Discover how a language runs your code, step by step.
Python · JavaScript · TypeScript
Your first contact with lexers and grammars. Tokenize, build the tree and fail with useful errors.
TypeScript · Python · Go · Java
From the expression to the automaton. Backtracking, groups and character classes without your language's regex.
TypeScript · Python · Rust