Building a Compiler from Scratch

Build a compiler in Rust: from Python-like syntax to x86 assembly

Get notified when the book is available!

Build a Compiler from Scratch Book Cover

What You'll Learn

Parsing Techniques

Implement a recursive descent parser that handles operator precedence, associativity, and indentation-based syntax

Semantic Analysis

Build a simple type checker and name resolver.

Intermediate Representations

Construct an intermediate representation using control flow graphs (CFG) to enable analysis and optimization.

Code Generation

Translate high-level code into x86 assembly. You'll learn about register allocation, instruction selection, and more.

Optimization Techniques

Implement simple optimization passes including constant folding and dead code elimination

Error Handling and Recovery

Learn strategies for graceful error handling and recovery in your compiler, and display rich error messages to your users.

Runtime Systems

Understand memory management, garbage collection, and how to interface with the operating system.

Get Notified When It's Ready

Be the first to know when "Build a Compiler from Scratch" is available. Sign up for our waiting list and receive exclusive pre-launch content.