Hacker News new | past | comments | ask | show | jobs | submit login

I was just wondering... is there any hope to have minimalist Rust compilers? Something like TinyCC for C[0]?

[0] https://tiny.cc/




Your 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.


Yes and I've lost the window to edit my comment. Thanks for the correction :)


I 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.


The closest thing i am aware of is 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.


An 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.


I am not aware of anyone pursuing any.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: