4 ms·
You want to run a Zig compiler on an embedded system?
by moloch-hai 4y ago
You want to run a Zig compiler on an embedded system?
- satvikpendem 4y agoNot sure I understand your question, why wouldn't someone want to use Zig (or Rust, or Nim) instead of C or C++?
- moloch-hai 4y agoThis is about the language the compiler itself is coded in. It would be absurd to try to run a compiler on your ESP microcontroller just because that is where the program you are compiling is supposed to run. (That does not stop Forth fans, of course.) People do often run compilers on RaspPis and the like (though rarely for any good reason), but those compilers are most often coded in C++, whatever the language it is compiling, just like Zig's original compiler. Most of the Rust compiler is in C++, and they have no plan to change that.
- TUSF 4y ago> Most of the Rust compiler is in C++, and they have no plan to change that. What? I just went and searched the Rust compiler, and the only C++ code to speak of was LLVM itself, and a thin wrapper around LLVM to provide a C API. Which is pretty much the same state that Zig is in right now. (Although in Zig's case, LLVM is optional) Yeah, it's a lot of C++ that the Rust compiler relies on, but I don't think most people would really compare things like that.
- steveklabnik 4y ago… and the cranelift backend is in Rust, so “no plans to change that” is half correct at best.
- int_19h 4y agoRasPis and the like are literally more powerful than your typical desktop PC 20 years ago. They can run all kinds of compilers, interpreters etc just fine, including those that are bootstrapped. Real embedded is more challenging, but even then... DOS ran on 640 Kb of RAM for userspace, and it had C and even C++ (albeit pre-ISO) compilers, and many embedded platforms these days come with something comparable. Forth is really only necessary if you want to bootstrap on really low-memory stuff. "Why" is a different question. ~