Cc

Compilers

advanced

How text becomes a running program.

A compiler is a program that reads your code and writes an equivalent program in another language — usually machine code. Understanding the pipeline (lexing, parsing, type checking, optimization, code generation) demystifies error messages, explains what optimizers can and can't do, and covers the ideas behind every linter, formatter, and transpiler you use daily.

Language ToolsLinters & FormattersTranspilersPerformanceCS Fundamentals
0%
0/7 lessons

Setup

Concepts track — any compiler you already have works for the experiments. Godbolt (godbolt.org) shows compiler output for 40+ languages with zero install and is the single best companion to this track.

Bash
# Zero install: https://godbolt.org
# paste code, see assembly, toggle optimization flags

# Or a local C compiler via WSL:
wsl --install
# then inside WSL:
sudo apt install gcc
gcc -O2 -S hello.c -o hello.s   # emit assembly

Lessons

1
The Compiler Pipeline
Every compiler — GCC, V8, rustc, even the TypeScript checker — is the same assem
2
Lexing — Text to Tokens
The lexer reads raw characters and groups them into tokens: words, numbers, oper
3
Parsing — Tokens to Trees
Flat token lists become a tree that captures structure: what belongs to what, wh
4
Names, Scopes & Type Checking
The parser accepts 'undefined_thing + 3' happily — it's grammatically fine. Sema
5
Optimization — Where the Magic Lives
Naively translated code is slow. Optimizers transform the program — hundreds of
6
Code Generation, Linking & JITs
The last mile: optimized IR becomes real instructions with real registers, separ
7
Compilers Cheatsheet
The pipeline, the vocabulary, and the experiments — one page.