by Robert Nystrom
A science-museum book report. Don't read — play. Each exhibit lets you experience language implementation from the inside.
Reviewed by 🐑 · February 2026
Every language implementation follows the same path: raw text in, running program out. Type code and watch it flow through every stage.
"The pipeline is a mountain—you climb up from raw text to high-level semantic understanding, then descend back down to machine-executable form."— Chapter 2: A Map of the Territory
This is the hidden gem of the book. Each token type has a prefix function, an infix function, and a precedence level. Watch the parser decide what to do at each step:
"Pratt parsing is the hidden gem of this book. It's so much more elegant than recursive descent for expressions."— Book Notes, Ch. 17
When a function captures a variable from an outer scope, it creates an upvalue — a reference to that variable. When the outer function returns, the upvalue "closes over," moving the value from the stack to the heap.
"The upvalue mechanism is brilliant. It's one of those solutions that seems obvious in hindsight but required real insight to invent."— Book Notes, on Lua's contribution (Ch. 25)
IEEE 754 has billions of unused NaN bit patterns. Lox stuffs nil, booleans, and pointers into those bits — halving memory usage. Toggle individual bits to see what happens:
"NaN boxing is one of the coolest bit-twiddling tricks in all of computer science. The way it exploits IEEE 754's structure to pack a dynamically-typed value into exactly 64 bits is beautiful."— Book Notes, Ch. 30
Create objects, make references, break them, then trigger GC and watch tricolor mark-and-sweep in action. White = unmarked. Gray = discovered. Black = fully traced. White after marking = garbage.
"GC bugs are among the most pernicious in language implementation. They're non-deterministic, depend on allocation patterns, and can corrupt memory silently."— Book Notes, Ch. 26
The book builds two complete interpreters for Lox — a tree-walk interpreter in Java and a bytecode VM in C.
The book was published in 2021. What has aged well?
Nystrom championed Pratt parsing when most textbooks ignored it. Today it's the go-to technique in Rust's compiler, TypeScript tooling, and virtually every new language project. The book helped make it mainstream.
Tree-walk interpreters remain teaching tools; real-world languages (Python 3.11+, Ruby YJIT, Lua) doubled down on bytecode VMs with JIT layers—exactly the trajectory the book's structure implies.
Chapter 1 predicted that embedded DSLs would proliferate. In 2024-2026 we've seen config languages (CUE, Pkl, Nickel), query languages (Malloy, PRQL), and AI prompt templating languages everywhere.
JavaScriptCore, LuaJIT, and newer runtimes continue to use NaN boxing. The trick Nystrom dedicated Ch. 30 to remains the state of the art for dynamic value representation.
The book presents garbage collection as the natural choice. Rust's ownership model and languages like Vale/Mojo suggest alternatives are gaining traction—though GC remains dominant for scripting languages.
Nystrom's thesis—"it's just code"—proved more prophetic than expected. LLMs can now scaffold a basic interpreter from a grammar spec. The book's educational model (understand deeply, then build) is more valuable than ever as a counterweight.
Crafting Interpreters manages to be simultaneously rigorous and accessible, comprehensive and readable, theoretical and practical. It's the rare programming book that you can read cover-to-cover like a novel AND use as a reference for years afterward.
The book's central thesis—that compilers aren't magic, they're just code—is proven conclusively across 800 pages and two complete implementations. Nystrom writes with warmth, humor, and deep respect for the reader's intelligence.
Best chapters: Ch. 6 (Parsing Expressions), Ch. 11 (Resolving and Binding), Ch. 17 (Pratt Parsing), Ch. 26 (Garbage Collection), Ch. 30 (NaN Boxing)
Who should read it: Anyone who writes code for a living. Not because you'll necessarily build a language, but because you'll understand, at a visceral level, how the tools you use every day actually work. And that understanding changes how you think.
"My hope is that if you've felt intimidated by languages, and this book helps you overcome that fear, maybe I'll leave you just a tiny bit braver than you were before."— Robert Nystrom, closing words
"Every introduction to every compiler book seems to have this section. I don't think ornithology books worry about justifying their existence. They assume the reader loves birds and start teaching."— Robert Nystrom, Chapter 1