Skip to content

Instantly share code, notes, and snippets.

@aritode
Forked from mrnugget/interpreter_to_compiler.md
Created October 16, 2019 05:51
Show Gist options
  • Save aritode/cf099f2dea768f3ed511258f251a74a4 to your computer and use it in GitHub Desktop.
Save aritode/cf099f2dea768f3ed511258f251a74a4 to your computer and use it in GitHub Desktop.
So you're finished with "Writing An Interpreter In Go" and want to read more?

This is what I once wrote to a reader:

  • Nand2Tetris book - http://www.nand2tetris.org/
  • The paper "An Incremental Approach to Compiler Construction", by Abdulaziz Ghuloum. You can find a hosted PDF version of the paper and an implementation of its contents here: https://github.com/namin/inc\
  • Jack Crenshaw's classic "LET'S BUILD A COMPILER" from 1988. Even though it's kinda dated (he's using Turbo Pascal), it's one of the great "let's roll our sleeves up and write some code" texts. Here is the PDF version: http://compilers.iecc.com/crenshaw/tutorfinal.pdf
  • Then there are also the 4th and 5th chapters of Structure an Interpretation of Computer Programs (SICP), in which you'll build an interpreter and a kinda bytecode-compiler for a virtual register machine. It's a pretty abstract and seemingly alien affair (using a Lisp dialect to build a virtual register machine for a bytecode defined in Lisp, produced by a Lisp compiler, etc.), but it teaches the concepts behind the whole compiler and VM thing. You can find the full text here: https://mitpress.mit.edu/sicp/full-text/book/book-Z-H-4.html#%_toc_start

Then I'd say diving into the source code is in order. I recommend starting with a small codebase. Here is a list of a few of my favorites:

More specific recommendations depend on what you want to do exactly: a compiler that outputs machine good, one that outputs C, one that outputs assembly and uses an assembler, or maybe even a JIT compiler?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment