Liste des Groupes | Revenir à cl c |
On 27/11/2024 09:10, Bart wrote:It's just harder. The transformations become harder, if I want to generated structured C. My syntax is expression-based, for example.On 27/11/2024 11:57, Bart wrote:But you can write it in a different way, can't you?On 27/11/2024 01:52, Thiago Adams wrote:>I also use ILs for my compilers, but I write my own backends. I've worked on two diifferent kinds. One looks like a HLL, and only exists for my language. So this original source:>
I forgot to say that I've also tried transpiling to C from my language.
>
That makes some things simpler (I don't need to write the backend! And I get optimisation for free), but C is a poor fit for my language. So programs that need to be transpiled to C can only use a restricted, crippled set of features.
>
My HLL example produces this C:
>
static void $t$f(void) {
i64 r;
i64 a;
i64 b;
i64 c;
r = (a + (b * c));
}
>
The advantage of my ILs is that they don't have the restrictions of C. For example, they will translate this:
>
(c | a | b) := 0 # (assign 0 to either a or b)
>
with no problem. The C transpiler will produce this:
>
(!!(c) ? a : b) = (i64)0;
>
But this is not legal C.
This raises the question what cannot be done in C?
Les messages affichés proviennent d'usenet.