Skip to main content

Compiler Dungeon ️⚙️

· 2 min read

This is an educational compiler built to demonstrate the core ideas in compiler theory. It targets a small language expressive enough to write real programs with, while staying small enough that every stage of the pipeline fits in your head at once. The source is on github, and the language itself is documented here.

I'll be writing more detailed posts on individual parts of this pipeline over time. This post is the front door: an interactive compiler embedded directly in the page, so you can see how a program actually moves through each stage before reading about any of them in depth.

Interactive compiler​

Edit the source below, then step through the pipeline with the buttons underneath it. The representations (Tokens, AST, HIR, IR, SSA) are what your program looks like at each point; SCCP and DCE are optimization passes that rewrite the SSA form rather than being representations of their own, so selecting one shows a before/after instead of pretending it's just another tab.

Loading compiler explorer…