📖 Overview
Crafting Interpreters guides readers through building two complete programming language implementations from scratch. The book demonstrates creating both a simple tree-walking interpreter and a bytecode virtual machine.
The first half focuses on implementing a language called Lox in Java, covering scanning, parsing, and direct code interpretation. The second half rebuilds Lox from the ground up in C, introducing concepts like bytecode compilation and virtual machine design.
Each chapter breaks down a specific component of language implementation with clear explanations and working code examples. The text moves step-by-step through the engineering decisions and tradeoffs involved in creating a real programming language.
The book serves as both a practical programming guide and an exploration of how programming languages bridge human thought and machine execution. Through the lens of building interpreters, it reveals core principles about computation, abstraction, and the nature of programming itself.
👀 Reviews
Readers consistently highlight the book's clear explanations and gradual progression from basic to advanced concepts. Many appreciate the detailed walkthrough of building two complete interpreters, with code examples in multiple languages.
Liked:
- Step-by-step approach with extensive code examples
- Engaging writing style with wit and illustrations
- Balance of theory and practical implementation
- Strong focus on design decisions and tradeoffs
Disliked:
- Some found the Java implementation sections less relevant
- A few readers wanted more advanced optimization topics
- Code formatting issues in the PDF version
Ratings:
Goodreads: 4.8/5 (236 ratings)
Amazon: 4.8/5 (131 reviews)
Notable reader comments:
"Finally understood how garbage collection works after years of confusion" - Goodreads reviewer
"The illustrations make complex concepts click" - Amazon review
"Best technical book I've read in 15 years of programming" - Hacker News comment
"Worth reading just for the clear explanations of scanning and parsing" - Reddit r/programming
📚 Similar books
Writing An Interpreter In Go by Thorsten Ball
A step-by-step guide to building an interpreter for a JavaScript-like language using Go, with implementation details for lexing, parsing, and evaluation.
Compilers: Principles, Techniques, and Tools by Alfred V. Aho, Monica S. Lam, Ravi Sethi, Jeffrey D. Ullman The foundational text on compiler construction covers lexical analysis, parsing, syntax-directed translation, and code generation with practical examples.
Programming Language Pragmatics by Michael L. Scott This text examines the implementation and design choices behind programming language features through concrete examples in multiple languages.
Language Implementation Patterns by Terence Parr The book presents 31 patterns for building programming languages, from parsing to interpreting to compiling.
Engineering a Compiler by Keith Cooper, Linda Torczon A detailed exploration of modern compiler construction focuses on practical techniques used in production compilers.
Compilers: Principles, Techniques, and Tools by Alfred V. Aho, Monica S. Lam, Ravi Sethi, Jeffrey D. Ullman The foundational text on compiler construction covers lexical analysis, parsing, syntax-directed translation, and code generation with practical examples.
Programming Language Pragmatics by Michael L. Scott This text examines the implementation and design choices behind programming language features through concrete examples in multiple languages.
Language Implementation Patterns by Terence Parr The book presents 31 patterns for building programming languages, from parsing to interpreting to compiling.
Engineering a Compiler by Keith Cooper, Linda Torczon A detailed exploration of modern compiler construction focuses on practical techniques used in production compilers.
🤔 Interesting facts
🔹 Robert Nystrom wrote most of "Crafting Interpreters" during his daily train commute to and from Google, where he worked on the Dart programming language.
🔹 The book implements two complete interpreters for the same language (Lox): one in Java focusing on clarity, and one in C focusing on performance—giving readers insight into different implementation approaches.
🔹 The dragon on the book's cover is named Lox, after the language taught in the book, and was illustrated by Max Kanat-Alexander, who also created artwork for other programming books.
🔹 The author made the entire book available for free online while simultaneously selling physical copies, a model that proved successful enough that he used it again for his next book, "Game Programming Patterns."
🔹 The Lox programming language created for the book has inspired numerous implementations in different programming languages by readers, including versions in Rust, Go, and Python, forming an active community of language implementers.