logoalt Hacker News

maltyxxxtoday at 11:46 AM1 replyview on HN

Worth also mentioning Crafting Interpreters by Robert Nystrom (craftinginterpreters.com) as a companion — it implements two interpreters in Java then C, covering a treewalk interpreter and a bytecode VM, and is freely available online. Together with this journey and nils-m-holm's Practical Compiler Construction mentioned above, you get a remarkably complete self-study path from parsing fundamentals all the way to code generation.

On the C vs typed language debate: C forces you to think about representation explicitly — no algebraic types to lean on, every tagged union is manual. That arguably teaches you more about what a compiler actually does structurally. But OCaml or Haskell's pattern matching makes the recursive descent so natural that it's worth attempting both if you have the time. They illuminate different things.


Replies