DEV Community

Cover image for From Binary to Brilliance: How Compilers Learned to Write Compilers a.k.a Bootstrapping
Biswas Prasana Swain
Biswas Prasana Swain

Posted on

From Binary to Brilliance: How Compilers Learned to Write Compilers a.k.a Bootstrapping

Programming languages didn’t pop out of thin air. Humans painfully invented them so we could boss computers around without manually flipping switches like cavemen with PhDs. Here’s the story.

1. Early Days: Speaking Robot Grunt Language

1940s–1950s

  • Computers only understood machine code (just 0s and 1s).
  • Then humans realized life shouldn’t be torture, so they invented assembly language (short words like ADD, MOV).
  • These early languages were written directly in machine code or assembly because what else was available? Exactly nothing.

Languages: Machine Code, Assembly
Implementation: Written in machine code or assembly

2. High-Level Languages: Humans Stop Suffering

1950s–1960s
People said: “Let the computer do the boring work.”

  • FORTRAN (science & math)
  • COBOL (business)
  • LISP (AI, parentheses galore)

Compilers for these languages were mostly written in assembly, because assembly was the only grown-up in the room back then.

Languages: FORTRAN, COBOL, LISP
Implementation: Assembly

3. Compilers Learn to Write Compilers

1970s
Here comes the big brain move.

  • New languages started being written in the language itself.
  • This trick is called bootstrapping (more on that soon).

Examples:

  • C became a superstar. First versions in assembly, then rewritten in C.
  • Pascal: similar path.

Languages: C, Pascal
Implementation: Started in assembly, later self-hosted (written in themselves)

4. Object-Oriented Show-Off Era

1980s–1990s
Humans start organizing code like “objects,” because organizing life is too hard.

Languages:

  • C++ (C but angry and complicated)
  • Java (Write once, debug everywhere)
  • Python (finally readable)
  • JavaScript (only language people argue about daily)

Implementation languages:

  • C++: wrote itself using C++ (after initial C)
  • Java: implemented in C/C++
  • Python: implemented mostly in C
  • JavaScript: implemented in C/C++

5. The Modern Chaos

2000s–Now
Thousands of languages because developers love reinventing the wheel.

Examples:

  • Rust: implemented in Rust (after initial help from C++)
  • Go: implemented in C first, later in Go itself
  • Swift: implemented in C++ and Swift
  • Kotlin, TypeScript, etc.: often implemented using existing languages like Java or JavaScript

What is Bootstrapping?

This part is actually cool.

Bootstrapping is when a programming language is:

  1. First implemented using an older language (often C or assembly)
  2. Then rewritten using itself
  3. Then its own compiler builds the new compiler

Like a kid growing up and then becoming their own parent’s boss.

Example with C:

  1. Write a tiny C compiler in assembly
  2. Use it to compile a better C compiler written in C
  3. Repeat until humans are free and the compiler is a beast

Why do this?

  • Self-hosted compilers are easier to maintain
  • They prove the language is powerful enough to build real systems

Summary Table

Language First Compiler Implementation Later/Self Implementation
Assembly Machine code Itself (assembly)
FORTRAN, COBOL Assembly Assembly/C
C Assembly C
C++ C C++
Java C/C++ Java (partially)
Python C Python/C
Go C Go
Rust C++ Rust

Final Wisdom

Programming language history is basically:

  • Start from binary pain
  • Invent slightly less painful systems
  • Use those systems to build better systems
  • End up with JavaScript frameworks that change every week anyway

Hope your brain upgraded a bit.

Top comments (0)