What?
What?
Languages that do this
Why?
- provides a large codebase for working on (dogfooding)
- encourages language improvements (perf and features)
- provides a big example project
Why not?
- takes a long time
- initially will be slower (perf)
- language bugs or missing features hold back development
- May require features that you didn't intend to add to a language
How
Start with a regular compiler
it can be in any language, but similarity to both the compiled output and the target language is helpful
Create a stable version
- Write a lot of tests
- Have a benchmark
Rewrite your compiler in the target language
Use the test suite and benchmarks to guide you and fix errors
Release a version with the new compiler
From then on, your compiler must be written in code on the n-1th version
Sidenote: quines
Links
- Quines: https://cs.lmu.edu/~ray/notes/quineprograms/
- Derw: https://www.derw-lang.com/
- Derw's work to be self-bootstrapping: https://derw.substack.com/p/writing-a-bootstrapping-compiler