Bootstrapping in compiler design is the process of building a compiler that can compile its own source code, usually starting with a small initial compiler written in another language or a simpler subset of the same language.

Quick Scoop

In plain terms, you begin with a minimal “starter” compiler, use it to compile a more capable version, and repeat until the compiler can build itself. This solves the classic chicken-and-egg problem of how to create the first compiler for a language.

How it works

  • Start with a basic compiler, often written in assembly or another existing language.
  • Use that compiler to build a better version of the same compiler.
  • Repeat the process until the compiler is self-hosting, meaning it can compile its own source code.

Why it matters

Bootstrapping is important because it lets language tools grow gradually, makes it easier to add features, and is commonly used when bringing up a new language or moving a compiler to a new platform. It is also useful for cross- compilation, where a compiler runs on one machine but produces code for another.

Simple example

A new language might first get a tiny compiler written in C or assembly. That tiny compiler then compiles a larger compiler written in the new language itself, and after a few rounds, the compiler becomes self-hosting.

If you want, I can also explain bootstrapping vs cross-compilation in one short table.