Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A book about writing compilers. In very early stages of writing.
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
README.md

README.md

So, I'm writing a compiler book. Inspiration comes from this HN comment. Kudos also to Matthew Walton for thinking it'd be a good idea. ☺

Here's a tentative table of contents, cribbed straight from the HN comment in question, but hopefully evolvable into something more complete:

  • SSA
  • abstract interpretation
  • compiling high level languages
  • pointer analysis
  • compiling dynamic dispatch
  • garbage collection
  • closures

Other ideas, added later:

  • various optimizations, such as loop optimizations, strength reduction, and data-flow optimizations
  • register allocation

I expect to delve deeply into the Dragon book, SICP, and Modern Compiler Design in order to learn more of the theory and practice of writing compilers. It'll be both a learning experience and a teaching experience. ☺

My plan:

  • Use nqp as the implementation language/compiler platform. It has Perl 6 grammars and is meant to be used to build higher-level languages.
  • Build a language (called "Nugget") which is easy to read and explain. It has a small core and is easy to improve in various directions. It is powerful enough to self-host a parser easily.

Oh, here's another link, full of compiler optimizations. Might be useful when I dig into the literature.

vendethiel suggested I have a look at this set of AST-based compiler optimizations. Looks very cool. Apparently there's a tool to see exactly what an optimization did.

This post about compiling a small example language to C is just incredibly clear and inspiring.

Something went wrong with that request. Please try again.