3 ms·
I was just wondering... is there any hope to have minimalist Rust compilers? Something like TinyCC for C[0]? [0] https://tiny.cc/ https://tiny.cc/
by haolez 6y ago
I was just wondering... is there any hope to have minimalist Rust compilers? Something like TinyCC for C[0]?
[0] https://tiny.cc/ https://tiny.cc/
- steveklabnik 6y agoI am not aware of anyone pursuing any.
- kibwen 6y agoYour link there is to a link shortener, I think you mean TCC. :) It really depends on what you're actually asking for. Do you want, for example, a "slimmer" Rust compiler that jettisons all the stuff that supports older language editions? Do you want a "simpler" compiler that only uses straightforward algorithms at the expense of compiler speed? Or do you want a faster compiler that does less optimization at the expense of code generation quality? The latter, at least, is something that the Cranelift backend for rustc hopes to achieve.
- haolez 6y agoYes and I've lost the window to edit my comment. Thanks for the correction :)
- twic 6y agoThe closest thing i am aware of is mrustc: https://github.com/thepowersgang/mrustc https://github.com/thepowersgang/mrustc But AIUI that is not aimed at being a Rust compiler you would actually use day-to-day, just at being a way to bootstrap a Rust toolchain without needing a Rust compiler.
- masklinn 6y agoAn interpreter might make more sense, as compiling rust in a straightforward manner (without optimisations) is really slow and takes a lot of space. It might not be slower to just interpret it, and avoiding binary generation might be advantageous.
- pornel 6y agoI don't think so. The type system is pretty advanced, and type inference is required to compile it. Macros, proc macros, and modules handle tons of details, and aren't just textual inclusion like in C. The borrow checker is technically optional (as proven by mrustc), but if you wanted to implement it, it's no longer a set of simple scope rules, but more like a flavor of Prolog inside the compiler. These things are awesome for the power and usability of the language, but aren't tiny.