Sujet : Re: question about linker
De : bc (at) *nospam* freeuk.com (Bart)
Groupes : comp.lang.cDate : 27. Nov 2024, 13:10:22
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vi727c$7be$2@dont-email.me>
References : 1 2 3 4 5 6 7
User-Agent : Mozilla Thunderbird
On 27/11/2024 11:57, Bart wrote:
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.