3 ms·
> Even today, if you were to create a brand new language, you'd likely write the compiler in C (or maybe C++). You might write the bootstrapping compiler in C
by fasquoika 9y ago
> Even today, if you were to create a brand new language, you'd likely write the compiler in C (or maybe C++).
You might write the bootstrapping compiler in C for portability reasons, but you'd probably write the real compiler in the new language itself. Not to mention that if you don't mind the extra dependency on POSIX platforms you don't even need to write the bootstrapping one in C. For example, the Rust compiler frontend was originally written in OCaml, and is now written in Rust with a fairly complicated bootstrapping process. The backend is still C because it uses LLVM, but it hardly has to be
- kzisme 9y agoIf I remember correctly Go's first few compiler implementations were written in C, but later were written in Go (bootstrapped by C).
- FreeFull 9y agoThey actually wrote a tool that turned C code into (unidiomatic) Go code, and then later gradually improved the codebase they got from that.