Compiler Design

A compiler is the most quietly ambitious program most engineers ever use: it reads text written for a human, proves things about what that text means, and re-expresses it as instructions for a machine that shares none of the source language's assumptions — all while running in near-linear time and catching your mistakes. Compiler design is the craft of building that machine, and it is one of the most satisfying subjects in all of computer science because every piece connects: automata theory becomes a scanner, grammars become a parser, lattices become an optimiser, graph colouring becomes register allocation.

This master's-level course takes the classic route of the "Dragon Book" (Aho, Lam, Sethi & Ullman), Appel's Modern Compiler Implementation, and Cooper & Torczon's Engineering a Compiler. It runs the full length of the pipeline — lexing, parsing, semantic analysis, runtime environments, intermediate code, code generation, and the deep world of dataflow analysis and optimisation — then closes with modern topics: SSA, graph-colouring allocation, interprocedural and alias analysis, the polyhedral model, JIT compilation and LLVM. It assumes you already know the undergraduate treatment of the compiler phases, the automata and regular languages of theory of computation, and a little graph theory.

Module 1 — The anatomy of a compiler

Module 2 — Lexical analysis

Module 3 — Syntax analysis

Module 4 — Semantic analysis

Module 5 — Runtime environments

Module 6 — Intermediate code generation

Module 7 — Code generation

Module 8 — Dataflow analysis and optimisation

Module 9 — Advanced and modern topics

Begin → The Structure of a Compiler