In alt.folklore.computers c186282 <c186282@nnada.net> wrote:
On 1/6/26 07:16, Waldek Hebisch wrote:
In alt.folklore.computers c186282 <c186282@nnada.net> wrote:
<snip>
Hmm ... look at all the GNU 'compilers' -
FORTRAN, COBOL, Ada, 'D', M2, Rust,C++,
G++, even Algol-68. None are 'compilers'
per-se, but to-'C' TRANSLATORS. So, 'C',
pretty much All Are One And One Is All.
No. Compiler as first stage translate given language to a
common representation. This representatiton is different
than C. Ada and GNU Pascal have parametrized types, there
is nothing like that in C. C++ (and some other languages)
have exceptions, C do not have them. There are several
smaller things, for example Ada or Pascal modulo is different
that C/Fortran modulo. During optimization passes gcc
keeps such information, to allow better optimization and
error reporting.
There were/are compilers that work by translating to C. But
this has limitations: generated code typically is worse because
language specific information is lost in translation. Error
reporting is worse because translator is not doing as many
analyzes as gcc do. For those reasons compilers in gcc
generate common representation which contains sum of features
of all supported languages and not C.
You give it a file in whatever lang, it produces
a file in 'C' and compiles that.
No, if you looked at what compilers in gcc are doing you
will see that there are no intemediate C file. There
is intermediate assembler, but between source file and
assembler each compiler work independently
cross@spitfire.i.gajendra.net (Dan Cross) writes:
In article <84c7R.819121$PGrb.160843@fx10.iad>,
Scott Lurndal <slp53@pacbell.net> wrote:
cross@spitfire.i.gajendra.net (Dan Cross) writes:
In article <10jjc9s$3uhtk$1@dont-email.me>,
Chris Ahlstrom <OFeem1987@teleworm.us> wrote:
Waldek Hebisch wrote this post by blinking in Morse code:
In alt.folklore.computers c186282 <c186282@nnada.net> wrote:
<snip>
Hmm ... look at all the GNU 'compilers' -
FORTRAN, COBOL, Ada, 'D', M2, Rust,C++,
G++, even Algol-68. None are 'compilers'
per-se, but to-'C' TRANSLATORS. So, 'C',
pretty much All Are One And One Is All.
No. Compiler as first stage translate given language to a
common representation. This representatiton is different
than C. Ada and GNU Pascal have parametrized types, there
is nothing like that in C.
<interjection>
C++ (and some other languages)
have exceptions, C do not have them.
What about setjmp()/longjmp() ?
Not at all the same thing. `setjmp`/`longjmp` are about
non-local flows of control; exceptions are about non-local
passing of values.
However, in many real world situations, [sig]setjump and
[sig]longjmp can be used to emulate exceptions.
Yes, I said just that. :-)
I have a C++ application that models a computer (Burroughs V380
et alia). The thread that models each processor (cpu) uses
longjmp whenever a condition is encountered that would have
been signaled as a fault on the real cpu. The processor code
doesn't do dynamic memory allocation; and the fault code is
stored in the processor class before the longjmp call.
I once tried replacing setjmp/longjmp with C++ exceptions which
led to a 20% reduction in simulated CPU performance (as measured
by the time to compile a COBOL program).
Huh. Interesting. I wonder why...possibly to run a bunch of
nop destructors?
A large component of the overhead was the code generated in every
function to handle unwinding during exception processing.
When
using setjmp/longjmp, I compiled with the following options so
it wouldn't generate the unwind code:
GXXFLAGS = -mno-red-zone
GXXFLAGS += -fno-strict-aliasing
GXXFLAGS += -fno-stack-protector
GXXFLAGS += -fno-exceptions
GXXFLAGS += -Wall
GXXFLAGS += -mtune=native
On 2026-01-06, Waldek Hebisch <antispam@fricas.org> wrote:
In alt.folklore.computers c186282 <c186282@nnada.net> wrote:
On 1/6/26 07:16, Waldek Hebisch wrote:
In alt.folklore.computers c186282 <c186282@nnada.net> wrote:
<snip>
Hmm ... look at all the GNU 'compilers' -
FORTRAN, COBOL, Ada, 'D', M2, Rust,C++,
G++, even Algol-68. None are 'compilers'
per-se, but to-'C' TRANSLATORS. So, 'C',
pretty much All Are One And One Is All.
No. Compiler as first stage translate given language to a
common representation. This representatiton is different
than C. Ada and GNU Pascal have parametrized types, there
is nothing like that in C. C++ (and some other languages)
have exceptions, C do not have them. There are several
smaller things, for example Ada or Pascal modulo is different
that C/Fortran modulo. During optimization passes gcc
keeps such information, to allow better optimization and
error reporting.
There were/are compilers that work by translating to C. But
this has limitations: generated code typically is worse because
language specific information is lost in translation. Error
reporting is worse because translator is not doing as many
analyzes as gcc do. For those reasons compilers in gcc
generate common representation which contains sum of features
of all supported languages and not C.
You give it a file in whatever lang, it produces
a file in 'C' and compiles that.
No, if you looked at what compilers in gcc are doing you
will see that there are no intemediate C file. There
is intermediate assembler, but between source file and
assembler each compiler work independently
Still, Bjarne Stroustrup's first implementation of C++
was a program called cfront, which translated C++ to C.
In article <fzf7R.805815$i%aa.272881@fx12.iad>,
Scott Lurndal <slp53@pacbell.net> wrote:
cross@spitfire.i.gajendra.net (Dan Cross) writes:
In article <84c7R.819121$PGrb.160843@fx10.iad>,
Scott Lurndal <slp53@pacbell.net> wrote:
cross@spitfire.i.gajendra.net (Dan Cross) writes:
In article <10jjc9s$3uhtk$1@dont-email.me>,
Chris Ahlstrom <OFeem1987@teleworm.us> wrote:
Waldek Hebisch wrote this post by blinking in Morse code:
In alt.folklore.computers c186282 <c186282@nnada.net> wrote:
<snip>
Hmm ... look at all the GNU 'compilers' -
FORTRAN, COBOL, Ada, 'D', M2, Rust,C++,
G++, even Algol-68. None are 'compilers'
per-se, but to-'C' TRANSLATORS. So, 'C',
pretty much All Are One And One Is All.
No. Compiler as first stage translate given language to a
common representation. This representatiton is different
than C. Ada and GNU Pascal have parametrized types, there
is nothing like that in C.
<interjection>
C++ (and some other languages)
have exceptions, C do not have them.
What about setjmp()/longjmp() ?
Not at all the same thing. `setjmp`/`longjmp` are about
non-local flows of control; exceptions are about non-local
passing of values.
However, in many real world situations, [sig]setjump and
[sig]longjmp can be used to emulate exceptions.
Yes, I said just that. :-)
I have a C++ application that models a computer (Burroughs V380
et alia). The thread that models each processor (cpu) uses
longjmp whenever a condition is encountered that would have
been signaled as a fault on the real cpu. The processor code
doesn't do dynamic memory allocation; and the fault code is
stored in the processor class before the longjmp call.
I once tried replacing setjmp/longjmp with C++ exceptions which
led to a 20% reduction in simulated CPU performance (as measured
by the time to compile a COBOL program).
Huh. Interesting. I wonder why...possibly to run a bunch of
nop destructors?
A large component of the overhead was the code generated in every
function to handle unwinding during exception processing.
That makes sense; thanks.
When
using setjmp/longjmp, I compiled with the following options so
it wouldn't generate the unwind code:
GXXFLAGS = -mno-red-zone
GXXFLAGS += -fno-strict-aliasing
GXXFLAGS += -fno-stack-protector
GXXFLAGS += -fno-exceptions
GXXFLAGS += -Wall
GXXFLAGS += -mtune=native
Most of those seem irrelevant to generating extra code for stack
unwinding.
On the other hand, a compiler that uses another compiled language
as intermediate code is a strange beast, probably better called a translator.
On Tue, 6 Jan 2026 21:00:25 -0500, c186282 wrote:
Clearly the GCC collection is More Complicated than I thought.
Back when dinosaurs roamed the earth it was the GNU C Compiler. Then it learned new tricks.
https://en.wikipedia.org/wiki/Register_transfer_language
But I'm still not sure I'll call them 'compilers'
in the older sense of the word. Some intermediate term is required.
That would be RTL. Microsoft's CIL is similar but depends on a runtime. CLang//LLVM is another approach which overlaps GCC. fwiw I have both on
this box.
IRs have been used for a long, long time.
https://dl.acm.org/doi/epdf/10.1145/2480741.2480743
Some light reading:
https://archive.org/details/principlesofcomp0000ahoa/mode/2up
| Sysop: | datGSguy |
|---|---|
| Location: | Eugene, OR |
| Users: | 7 |
| Nodes: | 4 (0 / 4) |
| Uptime: | 219:18:04 |
| Calls: | 361 |
| Calls today: | 34 |
| Files: | 14 |
| D/L today: |
68 files (1,095K bytes) |
| Messages: | 5,751 |
| Posted today: | 1 |