logoalt Hacker News

lioetersyesterday at 11:48 PM2 repliesview on HN

> For the past 3 years, I have been working on compiling Rust to C. .. This is, by my count, the 14th attempt: cilly

Gotta respect the dedication to a niche interest.

> The primary goal of this is support for old/obscure hardware with no LLVM/GCC support.

I remember reading about the bootstrapping question, how it typically requires a Rust compiler to build the Rust compiler from source. https://bootstrapping.miraheze.org/wiki/Bootstrapping_Specif...

Oh, but I see there's a C++ implementation of the Rust compiler. https://github.com/thepowersgang/mrustc

Anyway, this part sounds useful too, that crustc can compile across network and devices.

> You build a small C server on your Blorbo OS, run rustc on some normal platform like Linux, and let cilly talk over the wire.


Replies

lispwitchtoday at 12:51 AM

Guix uses mrustc for bootstrapping Rust, as required for compiler packages; it's a really impressive project and has worked well in that role for some time. This new project is interesting for other reasons though, because mrustc is targeted at the de fact "subset" of Rust in use by rustc at any given time. This looks like it could have broader applications, like compiling Rust programs for platforms not supported by LLVM. If it really targets ANSI C (C89 or so), that's potentially many more platforms than are possible with ordinary rustc

More on the Rust bootstrapping process (2018): https://guix.gnu.org/blog/2018/bootstrapping-rust/

zadikiantoday at 12:11 AM

So the author made a Rust to C transpiler and immediately used it to transpile... the Rust compiler. I love it.