digitalmars.D - add translate into c source code function
- d007 (3/3) May 08 2023 The zig lang, v lang is able to translate into C code.
- Walter Bright (4/8) May 09 2023 There isn't a current plan to implement one.
- Richard (Rikki) Andrew Cattermole (8/8) May 09 2023 I suspect c++ would be a better target instead.
- Sergey (3/4) May 09 2023 Zig could run from C, but not to C AFAIK.
- Sergey (4/8) May 10 2023 And it seems Odin also choose this path:
The zig lang, v lang is able to translate into C code. Is there a plan to translate d source code into C code ? (or maybe just betterC subset)
May 08 2023
On 5/8/2023 11:37 PM, d007 wrote:The zig lang, v lang is able to translate into C code. Is there a plan to translate d source code into C code ? (or maybe just betterC subset)There isn't a current plan to implement one. Translating into C comes with a lot of problems. For example, C doesn't specify the order of evaluation of terms in an expression, while D does.
May 09 2023
I suspect c++ would be a better target instead. We already have a bunch of capability for this with the C++ header generator. It only need to support a subset of the language, just enough to bootstrap the compiler. This would be a massive boost in undoing any harm from self hosting wrt. getting a working compiler going on a given target. Not to mention the potential to making gdc/ldc lives a bit easier.
May 09 2023
On Tuesday, 9 May 2023 at 06:37:58 UTC, d007 wrote:The zig lang, v lang is able to translate into C code.Zig could run from C, but not to C AFAIK. Nim does this thing.
May 09 2023
On Tuesday, 9 May 2023 at 07:41:07 UTC, Sergey wrote:On Tuesday, 9 May 2023 at 06:37:58 UTC, d007 wrote:And it seems Odin also choose this path: https://youtu.be/g1qF9LZOoFE https://github.com/graphitemaster/codinThe zig lang, v lang is able to translate into C code.Zig could run from C, but not to C AFAIK. Nim does this thing.
May 10 2023