Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Are there not a lot of embedded systems that only have a C compiler?


You want to run a Zig compiler on an embedded system?


Not sure I understand your question, why wouldn't someone want to use Zig (or Rust, or Nim) instead of C or C++?


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


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


… and the cranelift backend is in Rust, so “no plans to change that” is half correct at best.


RasPis 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. ~




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

Search: