| Deutsch English Français Italiano |
|
<vi7ak8$1fp9$2@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bart <bc@freeuk.com>
Newsgroups: comp.lang.c
Subject: Re: question about linker
Date: Wed, 27 Nov 2024 14:33:45 +0000
Organization: A noiseless patient Spider
Lines: 55
Message-ID: <vi7ak8$1fp9$2@dont-email.me>
References: <vi54e9$3ie0o$1@dont-email.me> <vi56tj$3ip1o$1@dont-email.me>
<vi583f$3ie0o$3@dont-email.me> <vi59df$3ip1o$3@dont-email.me>
<vi5qu0$3md4n$1@dont-email.me> <vi5u16$3me78$1@dont-email.me>
<vi71f9$7be$1@dont-email.me> <vi727c$7be$2@dont-email.me>
<vi73sh$agj$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 27 Nov 2024 15:33:44 +0100 (CET)
Injection-Info: dont-email.me; posting-host="94da1025fd5231eb125f80dc7027ef53";
logging-data="48937"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+iy9lVVEU2dl3f+avI7tZp"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:tBqzunWBiammvzFGA7WPbxt3e2U=
Content-Language: en-GB
In-Reply-To: <vi73sh$agj$2@dont-email.me>
Bytes: 3315
On 27/11/2024 12:38, Thiago Adams wrote:
> On 27/11/2024 09:10, Bart wrote:
>> 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.
>
> But you can write it in a different way, can't you?
> This raises the question what cannot be done in C?
It's just harder. The transformations become harder, if I want to
generated structured C. My syntax is expression-based, for example.
I used also a version called 'linear C' which was flattened C code, but
as I said in my last post, the result is usually a travesty of the
language. And the result absolutely needs an optimising C compiler,
otherwise the code would be even half the speed Tiny C.
Sometimes the C was used for distribution: so people can create binaries
locally, avoiding the AV issues with downloading binaries.
Now, for people using Windows, I'd be likely to provide a .ASM file
instead. For one thing, ASM would support inline ASM sequences in my
programs, which C can't handle.