Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What language was used to write Rust compiler? [duplicate]

Tags:

rust

94% of Rust compiler was written in Rust. So I can't understand how is it possible? Because for compiling rustc you already must have some rust compiler. Can someone explain how it works and how rust compiler was created?

like image 297
Dima Kudosh Avatar asked Jan 11 '16 19:01

Dima Kudosh


1 Answers

Simply put, once you have a compiler that compiles code, you can use that to develop and compile a new compiler. That new compiler can "understand" whatever language it's designed to compile.

So, suppose there was some C++ based rust compiler, and rust code was developed that compiles to a rust compiler, once you build that you have a rust based rust compiler.

like image 84
Amit Avatar answered Oct 19 '22 13:10

Amit