r/CompilerChallenges • • 9d ago

The r/CompilerChallenges Resource Library

This is our living collection of useful compiler resources: tutorials, papers, libraries, reference manuals, and tooling.

Found something that made a difficult concept click, or wrote something worth sharing? Please post it here. Resources for every level are welcome, from "what is an AST?" to instruction encoding, SSA construction, auto-vectorization, and GPU code generation.

3 Upvotes

2 comments sorted by

1

u/shrimpster00 9d ago

Beginner-friendly compiler tutorials

  • Crafting Interpreters: This is probably the best first resource. It builds the Lox language twice: first as a clean tree-walk interpreter, then as a bytecode VM in C, covering lexing, parsing, closures, classes, garbage collection, and optimization.

  • Build Your Own Lisp: This is another approachable, hands-on resource for the front-end of a compiler. It's particularly beginner-friendly, even if you're new to programming in general. This is handy if you want an early REPL and tangible progress.

  • LLVM Kaleidoscope Tutorial: This is an official tutorial for working with LLVM as a library. If you understand the basic frontend pipeline, this gets you to emitting LLVM IR, JIT compilation, optimization, object emission, and debug info.

  • An Incremental Approach to Compiler Construction: This is an excellent paper that walks you through parsing Scheme to emitting x86 assembly through stages. I highly recommend it. Here's a full implementation (github:namin/inc) following the paper.

  • Writing a C Compiler: This is based on Incremental Approach above, but for a small subset of C. I thought it was just okay, personally. It gets recommended enough that I'll list it anyway, though.

  • Essentials of Compilation: I haven't read this myself, but I've heard good things.

  • chibicc: A Small C Compiler: This isn't a tutorial, but it's a real implementation of a C compiler based on Incremental Approach above, with a Git history that demonstrates the incremental implementation.

1

u/shrimpster00 9d ago

Specifications and platforms

Language specifications:

ABI and calling-convention references:

ISA manuals

Object formats and debug info