finds.dev← search

// the find

munificent/craftinginterpreters

★ 10,868 · HTML · NOASSERTION · updated Aug 2024

Repository for the book "Crafting Interpreters"

The companion repository for Robert Nystrom's 'Crafting Interpreters' book — two complete implementations of a toy language called Lox, one in Java (tree-walk) and one in C (bytecode VM), woven together with the book's prose via a custom Dart-based static site generator. Aimed at developers who want to understand how interpreters actually work from first principles, not from academic papers.

The two-implementation approach is genuinely pedagogically smart: you see the same language built two ways, which makes the tradeoffs between AST interpretation and bytecode compilation concrete rather than theoretical. The C implementation (clox) is production-quality enough to be instructive — it has a real mark-and-sweep GC, upvalue handling for closures, and a hash table built from scratch. The chapter-by-chapter build system that generates working interpreter snapshots per chapter is unusually thoughtful — you can run the interpreter at any point in the book's narrative. The test suite covers the full Lox spec and is reusable against third-party implementations, which is a real gift to readers building their own port.

The build toolchain is a liability: it requires Dart, Make, a C compiler, and Java, none of which are obvious to set up together on Windows, and the README basically waves this away. The generated HTML is committed to the repo, which means `git log` is noisy and the diff story is terrible. The Lox language itself is intentionally limited (no modules, no standard library worth mentioning, no error recovery in the parser) which is fine for learning but means you can't use it as a springboard for a real language without significant rework. Last meaningful push was August 2024 — the book is finished, so this is expected, but issues and community ports on the wiki vary wildly in quality with no curation.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →