Hello,
What does " 94% of Rust compiler was written in Rust ." mean?
When a language not invented then how write itself?
Thank you.
Hello,
What does " 94% of Rust compiler was written in Rust ." mean?
When a language not invented then how write itself?
Thank you.
You can always write a compiler for a language that does not exist in a language that does exist.
One could write a Rust compiler in C++ for example. I believe the first Rust compiler was written in Ocaml
When that works you can write a compiler for your new language in the new language itself, using the previous compiler to compile it.
Of course if you have no high level language compiler to start with then you have to write the compiler for your new high level language in assembler.
If you have no assembler you are going to have to assemble your instructions into hexadecimal or binary manually and get them into your machines memory some how. Been there, done that.
There is an early version written in something that isn't rust, and if you need the new compiler from scratch, you compile a long chain of compilers. This is called bootstrapping. You can read more here.
There is also https://github.com/thepowersgang/mrustc, which is a C++ implementation of a rust compiler capable of bootstrapping rustc 1.19 and 1.29.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.