What is a self-hosting compiler?
A self-hosting compiler is a compiler that is written in the language it compiles. Once self-hosted, the language no longer depends on another language for its compiler. Self-hosting languages include Rust, Go, TypeScript, Haskell, and Kotlin, among others.
Details
Self-hosting is closely related to bootstrapping. A compiler is self-hosting when its source code is written in the language it compiles — meaning it can compile itself.
Self-hosting compilers:
- Rust — rustc is written in Rust (self-hosted since 2011)
- Go — gc toolchain is written in Go (since version 1.5)
- TypeScript — tsc is written in TypeScript
- Haskell/GHC — GHC is written in Haskell
- Java/javac — javac is written in Java
Self-hosting is considered a sign of language maturity. It also provides a kind of correctness check: if the language's own compiler works, many of the language's features have been validated in a real-world use case.
Explore in the Graph
See implementation and influence relationships interactively.
Open Interactive Graph →