Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You compile the next version of the compiler using the previous version. That does mean that the first version of the compiler cannot be written in the target language. Once you've got that working you can write a new compiler in the target language and compile it with the previous compiler.

Back in ye olden days the first assembler was written in machine code. The first C compiler was written in assembly, and the first D compiler in turn was written in C.



The first C compiler was written in BCPL IIRC, the D compiler was written in C++ up until about 2016-ish


I figured someone would point out that I missed a few steps ;)

The explanation of how a compiler can be implemented in its target language still holds though.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: