A JSON parser
Your first contact with lexers and grammars. Tokenize, build the tree and fail with useful errors.
TypeScript · Python · Go · Java
Tokenizer, parser, evaluator and closures. Discover how a language runs your code, step by step.
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.
Lisp was chosen for one reason: its syntax is so minimal that the parser gets out of the way in an afternoon, letting you spend the rest of the challenge on the interesting part, which is evaluation.
You'll build a full interpreter: environments, functions, closures, recursion and macros. By the end you'll understand what your favourite language does between hitting “run” and the result appearing.
11 stages across 4 phases. Every stage comes with its guide and its tests: you move on when they pass.
Tokenizer, S-expression reader, and representing atoms and lists.
Environments, variables, arithmetic, conditionals and special forms.
Lambdas, lexical scope, recursion and optimised tail calls.
Quote, macros, errors with a trace, and a small library.
Your first contact with lexers and grammars. Tokenize, build the tree and fail with useful errors.
TypeScript · Python · Go · Java
From source code to runnable bytecode. Lexing, AST, semantic analysis, code generation and a VM that runs it.
Rust · C++ · TypeScript
From the expression to the automaton. Backtracking, groups and character classes without your language's regex.
TypeScript · Python · Rust