Introduction to Compilers and Language Design
- title
- Introduction to Compilers and Language Design
- type
- book
- summary
- Free one-semester compiler textbook taking a C-like language down to working x86 or ARM assembly
- author
- Douglas Thain
- year
- 2020
- tags
- compilers, language-design, systems
- status
- want-to-read
- created
- 2026-07-23
- updated
- 2026-07-23
Douglas Thain's textbook for CSE 40243, the compilers course at Notre Dame, now in its second edition. The target is one semester of work ending in a compiler that accepts B-Minor, a small C-like language defined in Appendix B, and emits working x86 or ARM assembly. Stated prerequisites are some C programming plus the usual data structures and computer architecture courses, so it sits at the undergraduate end rather than the Dragon Book end.
Chapters follow the pipeline in order: scanning, parsing, then a separate chapter on parsing in practice, abstract syntax tree, semantic analysis, intermediate representation, memory organization, assembly language, code generation, optimization. The appendices carry the course project, the B-Minor spec, and coding conventions. A companion repository, compilerbook-examples, holds several scanners and parsers, a starter structure for the project compiler, and test cases for each stage of the scanner, parser, typechecker, and code generator, which is what makes it usable for self-study rather than only in a class.
Distribution is per-chapter PDFs plus a single-file PDF of the whole book, free for personal and academic use, with hardcover and paperback for sale and commercial redistribution prohibited. Thain asks that people link compilerbook.org instead of mirroring the PDFs, since editions keep changing.
Why it's on the list
The vault's compiler material all starts after the front end is already built: compiler-codegen-luck is about what Clang does with one line of C, retrofitting-jit-c-interpreters is about deriving a JIT from an existing interpreter, meta-tracing the same. Nothing covers scanning through code generation at the level where you write it yourself. This is the cheapest way to close that, and it's the same shape as building-a-debugger and virtual-machines-versatile-platforms already here: one system, built end to end, small enough to finish.