Review: Crafting Interpreters

Programming languages are something of a hobby of mine. Going as far back as undergrad, I’ve written a fair few interpreters and compilers over the years. I’ve never really gotten beyond a strong basic level, but I’ve always wanted to. Crafting Interpreters is a great book for exactly that.

The book essentially walks you through two styles of interpreter of the same language: just an AST walking style written in Java (the sort I’ve done a few times) and then a much more optimized one based on bytecode. There was something to learn on both sections though, since the the introduced language (lox) includes higher order functions and closures—certainly more interesting bits of languages to implement.

The latter really was the more interesting to me and really makes me want to go out and try building something more like that.

I think they biggest weakness of the book was in some ways also a strength: the author wrote all the code for the book before writing the prose—and then made sure that the book contained every line of the final interpreters. That does lead to some rather repetitive sections of adding very similar code to each new function, but so it goes.

Overall, well worth the read if you’re into programming languages, or really programming in general.