Build your own regex engine
Build a regex engine from scratch. Turn expressions into automata with backtracking, groups and character classes without using a regex library.
TypeScript · Python · Rust
Build a JSON parser from scratch. Tokenize input, parse the grammar, construct a syntax tree and report useful errors for invalid JSON.
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.
Project in preparation: we are completing and verifying the implementation path and its tests. The capabilities below describe the project goal; starting the project is not enabled yet.
JSON is the most boring format in the world, and that's exactly why it's the best place to learn to write parsers: its grammar fits on a napkin, yet it contains every idea you'll reuse later on real languages.
You'll build the parser in the two classic steps — tokenize, then assemble the tree — and finish it off with what separates an exercise from a usable tool: error messages that say what broke and on which line.
7 stages across 3 phases. Every stage comes with its guide and its tests: you move on when they pass.
Walk the input character by character and emit tokens: braces, commas, literals.
A recursive descent parser for objects, arrays and nested values.
Unicode escapes, scientific notation, and errors with line and column.
Build a regex engine from scratch. Turn expressions into automata with backtracking, groups and character classes without using a regex library.
TypeScript · Python · Rust
Build a Lisp interpreter from scratch. Write a tokenizer, parser and evaluator, then add closures to discover how a language executes your code.
Python · JavaScript · TypeScript
Build a compiler from scratch. Turn source code into bytecode with lexing, an AST, semantic analysis, code generation and a virtual machine.
Rust · C++ · TypeScript