|[5 earlier articles]|
|Compilers in six hours firstname.lastname@example.org (1994-05-18)|
|Compilers in six hours email@example.com (1994-05-19)|
|Re: Compilers in six hours firstname.lastname@example.org (1994-05-19)|
|Re: Compilers in six hours chase@Think.COM (1994-05-19)|
|Re: Compilers in six hours email@example.com (1994-05-20)|
|Re: Compilers in six hours firstname.lastname@example.org (Stefan Monnier) (1994-05-22)|
|Re: Compilers in six hours email@example.com (1994-05-24)|
|Re: Compilers in six hours firstname.lastname@example.org (1994-05-24)|
|Re: Compilers in six hours email@example.com (1994-05-25)|
|Re: Compilers in six hours firstname.lastname@example.org (1994-05-26)|
|From:||email@example.com (Harm Munk)|
|Organization:||Philips Research Laboratories Eindhoven, Netherlands|
|Date:||Tue, 24 May 1994 07:51:17 GMT|
chase@Think.COM (David Chase) writes:
>Reading other people's posts has tweaked a pet peeve of mine -- in many
>cases, I think a course on "compilation" would be well served by studying
>translation to Scheme, or perhaps C.
You are right in observing that many compilers nowadays compile to C.
Many compiler writers have this attitude: "Let C do the dirty work". Most
platforms have extremely well written C-compilers (gcc is an example that
comes to mind). There is much truth in the statement that C is evolving
into some high level, or universal assembler.
In fact, last week we gave a three day course on compiler construction.
We used a sobered down version of Wirth's Oberon-2 (aptly called
Soberon-2). Compiling to C has its charms: you get a running compiler very
quickly (of course, we implemented the compiler ourselves first, and
required about a man-month to get it up and running). But compiling to C
has its drawbacks: you have to pay a lot of attention to satisfying C
not-always-too-logical constructs. This tends to distract from the essence
of code generation. OK, it has its nice points: after writing a C-code
generator you are very well versed in mapping not only a source language
to a data structure, but also in mapping that data structure into a target
language. It even makes you wonder if code generation can be generalised.
Using C as a target language for a six hour course on compiler
construction may leave the students with the idea that they haven't seen
nothing yet. In my opinion, using a hypothetical machine, or maybe I
should say a idealised machine, is far more enlightening for students. We
ourselves are tinkering with the idea of rewriting the code generation
part of our Soberon-2 compiler for a n-address machine, where 0<=n<=3.
Then, when giving the course, the students can choose which code
generation they want to learn about.
Return to the
Search the comp.compilers archives again.