Last updated: 2026-11-15

U
Undergraduate level

The compiler, measured on itself

PatLang version. This demo was written, and its transcripts captured, with PatLang before version 2.0 (pat --ir-run and patc1.exe). What changed since v1 lists the differences.

Overview & Architecture

The self-hosted compiler front+middle end processing its own complete source (668274 chars), run under the Stage 0 interpreter while building this page:

Measurements

  • tokenize: 95020 tokens in 1100 ms
  • parse: 178 top-level statements in 1284 ms
  • lower: 176 functions in 1253 ms
  • codegen: 3300254 chars of Rust in 980 ms

The natively compiled compiler (patc1) runs the same front end roughly two orders of magnitude faster; rustc then dominates end-to-end compile time.