Thread overview
Is it possible to implement a C backend for the D language
Oct 26, 2022
electricface
Oct 26, 2022
FeepingCreature
Oct 26, 2022
Walter Bright
October 26, 2022

https://kristoff.it/blog/zig-self-hosted-now-what/

C backend
We are also working on a special backend, one that produces C source code. Progress on the C backend has recently shot forward (87% and counting) thanks to an amazing contribution.

What's interesting about this backend is that it will play a role in our plan to replace the old bootstrap compiler implementation and, perhaps even more interestingly, it will allow Zig to target architectures not supported by LLVM, including ones that force you to use a specific C compiler, like certain game console platforms.

October 26, 2022

On Wednesday, 26 October 2022 at 01:47:29 UTC, electricface wrote:

>

https://kristoff.it/blog/zig-self-hosted-now-what/

C backend
We are also working on a special backend, one that produces C source code. Progress on the C backend has recently shot forward (87% and counting) thanks to an amazing contribution.

What's interesting about this backend is that it will play a role in our plan to replace the old bootstrap compiler implementation and, perhaps even more interestingly, it will allow Zig to target architectures not supported by LLVM, including ones that force you to use a specific C compiler, like certain game console platforms.

Neat also uses a C backend for bootstrapping.

With DMD released from the need to stay C++ compatible for bootstrapping, you could even start using Phobos and slowly modernizing the codebase.

October 26, 2022
Yes, it's possible. One can take the intermediate code generated for the dmd backend, and generated C with it instead.