Compilers and language implementation
Build a small language implementation to understand parsing, binding, execution, and optimization. Classical compiler phases remain central; LLVM interfaces and implementation details must be pinned to a specific release.
Get an in-app notice when new lessons or practice are added.
12 chapters across 4 modules
Course chapters
Explore all 12 chapters in any order. Each chapter has learning goals, a practice prompt, and a primary reference; expanded reading pages are linked from their chapter titles.
No matching chapters. Try another term.
01 · Frontends and syntax3 chapters
Tokens to meaning
Follow a tiny expression through tokens, a syntax tree, and semantic checks.
- Separate source characters, tokens, syntax structure, and semantic interpretation
Practice: Tokenize a small expression and label which phase can detect each error.
Read the primary referenceExpanded reading · ReadyGrammars and precedence
- Express associativity and precedence without ambiguous interpretation
Practice: Design and test a grammar for arithmetic expressions and parentheses.
Read the primary referenceLesson guide · ReadyRecursive-descent parsing and errors
- Consume tokens while preserving useful source locations
Practice: Build an expression parser that reports an unexpected token and recovers at a boundary.
Read the primary referenceLesson guide · Ready
02 · Binding, types, and execution3 chapters
AST design and traversal
- Represent language structure independently of its original formatting
Practice: Write a pretty printer and test parse-print-parse behavior.
Read the primary referenceLesson guide · ReadyScopes, environments, and closures
- Resolve each name to the correct declaration and lifetime model
Practice: Implement nested scopes and test variable shadowing.
Read the primary referenceLesson guide · ReadyEvaluation and type checks
- Separate permitted operations from runtime execution
Practice: Add booleans and reject invalid arithmetic with a source-located error.
Read the primary referenceLesson guide · Ready
03 · Intermediate representations3 chapters
Bytecode and stack machines
- Trace an instruction sequence using a precise machine state
Practice: Compile expressions into a tiny stack machine and compare against direct evaluation.
Read the primary referenceLesson guide · ReadyControl flow and SSA concepts
- Explain basic blocks, branches, and values selected at merges
Practice: Draw control-flow graphs for if and while examples.
Read the primary referenceLesson guide · ReadyCode generation and target assumptions
- Separate language semantics from a chosen backend representation
Practice: Generate IR for a small pure function and inspect it with a pinned LLVM toolchain.
Read the primary referenceLesson guide · Ready
04 · Optimization and a complete tool3 chapters
Constant folding and preservation of behavior
- State the numeric and side-effect assumptions needed by an optimization
Practice: Implement a constant fold and test overflow and division-by-zero boundaries.
Read the primary referenceLesson guide · ReadyDiagnostics and test strategy
- Use successful programs, rejected programs, and differential checks
Practice: Build a language test suite that compares two execution paths.
Read the primary referenceLesson guide · ReadyPackage a miniature language
- Document syntax, semantics, limitations, and execution commands
Practice: Deliver a calculator language with variables, functions, readable errors, and examples.
Read the primary referenceLesson guide · Ready
Learn it. Check it. Try again.
11 original questions with worked explanations and source references. Filter by difficulty, revisit mistakes, and save your attempt as you go.
Open Compilers and language implementation practiceBooks & references
Free reading at the publisher or author’s site. External materials keep their own licenses.
- LLVM frontend tutorialLLVM project · course
Source & reuse terms
Free to read at the official provider. This catalog links to the source; it does not reproduce it or assert permission to redistribute it. Product use, hosted labs, and certificates may have separate costs.
- LLVM Language Reference ManualLLVM project · documentation
Source & reuse terms
Free to read at the official provider. This catalog links to the source; it does not reproduce it or assert permission to redistribute it. Product use, hosted labs, and certificates may have separate costs.
- Introduction to the Clang ASTLLVM project · documentation
Source & reuse terms
Free to read at the official provider. This catalog links to the source; it does not reproduce it or assert permission to redistribute it. Product use, hosted labs, and certificates may have separate costs.
- GNU Bison manualGNU project · book
Source & reuse terms
Free to read at the official provider. This catalog links to the source; it does not reproduce it or assert permission to redistribute it. Product use, hosted labs, and certificates may have separate costs.
- Crafting Interpreters (author’s online edition)Robert Nystrom · book
Source & reuse terms
The author provides this edition for free reading on the book website. This catalog links to that authorized edition and does not download, mirror, or infer redistribution rights for the book or illustrations.