---
title: Compilers & Interpreters
description: Compilers translate source code into runnable programs. You will learn lexing, parsing, type checking, intermediate representations, optimisation and code generation by building a language from scratch.
category: programming-tech
subcategory: computer-science
difficulty: beginner, intermediate, advanced
url: /subject/compilers-and-interpreters
---

# Compilers & Interpreters

Compilers translate source code into runnable programs. You will learn lexing, parsing, type checking, intermediate representations, optimisation and code generation by building a language from scratch.

## Available Resources

3 Books • 3 Courses • 1 Websites

## Courses

### 1. Nand2Tetris Part II

**Author:** Noam Nisan, Shimon Schocken

Project-based Coursera course from the Hebrew University in which learners build a stack-based virtual machine translator, a compiler for the Java-like Jack language and a small operating system for the Hack computer. Afterwards they understand how high-level code becomes executable machine instructions.

**Difficulty:** Intermediate | **Price:** Free

**Link:** https://www.coursera.org/learn/nand2tetris2

**Tags:** virtual-machine, compilers, memory-management, computer-architecture, nand2tetris

### 2. Cornell CS 6120: Advanced Compilers (Self-Guided)

**Author:** Adrian Sampson

Adrian Sampson's PhD-level course, released for self-study with videos, notes, assigned papers and implementation tasks. Fourteen lessons cover intermediate representations, dataflow analysis, SSA, loop optimisation, alias analysis, memory management and JIT compilation, using LLVM and the teaching IR Bril. Bril keeps implementation tasks tractable in any language while the LLVM tasks touch a production toolchain.

**Difficulty:** Advanced | **Language:** English | **Price:** Free

**Link:** https://www.cs.cornell.edu/courses/cs6120/2025sp/self-guided/

**Tags:** compiler-optimization, llvm, dataflow-analysis, ssa, jit-compilation, intermediate-representation

### 3. Stanford CS143: Compilers

Stanford's undergraduate compilers course, with public lecture slides, written assignments and solutions, and five programming assignments that build a working compiler for Cool, a small object-oriented language, targeting MIPS assembly.

**Difficulty:** Intermediate | **Language:** English | **Price:** Free

**Link:** https://web.stanford.edu/class/cs143/

**Tags:** compiler-construction, lexing-and-parsing, semantic-analysis, code-generation, cool-language

## Websites

### 1. My First Language Frontend with LLVM (Kaleidoscope Tutorial)

LLVM's official ten-chapter tutorial builds Kaleidoscope in roughly 1,000 lines: lexer, recursive-descent parser with operator precedence, LLVM IR generation, a JIT, control flow, mutable variables, object-file emission and DWARF debug information.

**Difficulty:** Intermediate | **Language:** English | **Price:** Free

**Link:** https://llvm.org/docs/tutorial/MyFirstLanguageFrontend/index.html

**Tags:** llvm, compilers, parsing, code-generation, jit-compilation, language-implementation

## Books

### 1. Writing a C Compiler: Build a Real Programming Language from Scratch

**Author:** Nora Sandler

A guided project in 792 pages: compile the smallest valid C program to x64 assembly, then add one language feature per chapter through types, pointers, structs and dynamic memory. Uses language-agnostic pseudocode plus a public open-source test suite.

**Difficulty:** Intermediate | **Language:** English | **Price:** Paid

**Link:** https://www.amazon.com/dp/1718500424?tag=edmonddante07-20

**Tags:** c-compiler, compiler-construction, x86-64-assembly, code-generation, type-checking

### 2. Engineering a Compiler (3rd Edition)

**Author:** Keith D. Cooper, Linda Torczon

Cooper and Torczon's 848-page textbook treats each compiler pass as an engineering problem with explicit tradeoffs: scanning, parsing, semantic elaboration, intermediate representations, SSA-based optimisation, instruction selection, scheduling and register allocation. Third edition adds chapters on runtime naming and code shape.

**Difficulty:** Advanced | **Language:** English | **Price:** Paid

**Link:** https://www.amazon.com/dp/0128154128?tag=edmonddante07-20

**Tags:** compiler-construction, compiler-optimization, ssa, register-allocation, instruction-selection, parsing

### 3. Crafting Interpreters

**Author:** Robert Nystrom

Robert Nystrom builds the Lox language twice: first a tree-walking interpreter in Java, then a bytecode virtual machine in C, covering scanning, parsing, resolution, closures, classes and garbage collection. The complete text is free online.

**Difficulty:** Intermediate | **Language:** English | **Price:** Free

**Link:** https://craftinginterpreters.com/

**Tags:** interpreters, bytecode-vm, parsing, garbage-collection, language-implementation

---

*This content is part of Dantes.io - Your Treasure Map to Knowledge*

*Curated by humans at Dantes.io. Personal study use welcome; republishing this curation requires permission (team@dantes.io).*

View this page online: https://dantes.io/subject/compilers-and-interpreters