Building a modern functional compiler from first principles.
Read Online:
- Chapter 1: Introduction
- Chapter 2: Parsing | Code
- Chapter 3: Lambda Calculus | Code
- Chapter 4: Simply Typed Lambda Calculus | Code
- Chapter 5: Evaluation | Code
- Chapter 6: Hindley-Milner Inference | Code
- Chapter 7: Design of Fun | Code
- Chapter 8: Layout and the Extended Parser | Code
- Chapter 9: The Renamer | Code
- Chapter 10: Typed Core and Core Lint | Code
- Chapter 11: Datatypes and Pattern Matching | Code
- Chapter 12: Records | Code
- Chapter 13: Kinds and Type Constructors | Code
- Chapter 14: Type Classes | Code
- Chapter 15: Monads, Do Notation and IO | Code
- Chapter 16: Pattern-Match Compilation | Code
- Chapter 17: The Prelude and Deriving | Code
- Chapter 18: A-Normal Form and Join Points | Code
- Chapter 19: Closure Conversion | Code
- Chapter 20: Data Representation and the Runtime | Code
- Chapter 21: LLVM Code Generation | Code
- Chapter 22: JIT and the REPL | Code
- Chapter 23: Optimization | Code
- Chapter 24: A Precise Garbage Collector | Code
- Chapter 25: Future Work
To build the chapters and the book, install Rust, just, Boehm GC and LLVM 22.
The pinned book tools are installed locally by just bootstrap.
$ just bootstrap
$ just build
$ just bookTo generate the pdf:
$ just pdfAny and all contributions are always welcome. As always, I rely on the perpetual kindness and goodwill of other compiler nerds (like you!) to help correct grammar, clarify, and fix errors.
This written work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. You may reproduce and edit this work with attribution.
The included source is released under the terms of the MIT License.