4 ms·
Considering that many compilers are written in the language they compile I was surprised by the Zig compiler being written in C++. Does anybody know the reason
by hwj 7y ago
Considering that many compilers are written in the language they compile I was surprised by the Zig compiler being written in C++.
Does anybody know the reason?
- euan_torano 7y agoThe stage 1 compiler is written in C++, but the Stage 2 compiler will be Zig: https://github.com/ziglang/zig#stage-2-build-self-hosted-zig-from-zig-source-code https://github.com/ziglang/zig#stage-2-build-self-hosted-zig... Eventually, i'll be Zig all the way down, but the language needs to get to the point where it can actually support writing a compiler for itself (and Andrew has some big plans for the way the compiler should work from what I understand).
- floatboth 7y agoHopefully stage1 will remain indefinitely for bootstrapping, like LDC's ltsmaster.
- nicoburns 7y agoCompilers have to be bootstrapped from another language (most commonly C and C++) to get going. Zig is only just getting to a point of maturity where it would be feasible to self-host, and it's still missing any sort of object/trait system, which are the sorts of things you really miss on large projects.
- deleted 7y ago[deleted]
- runevault 7y agoIt isn't even 1.0 yet, far too early to be talking about bootstrapping the compiler.