Re: Compilers in six hours

munk@prl.philips.nl (Harm Munk)
Tue, 24 May 1994 07:51:17 GMT

          From comp.compilers

Related articles
[5 earlier articles]
Compilers in six hours ssimmons@convex.com (1994-05-18)
Compilers in six hours ssimmons@convex.com (1994-05-19)
Re: Compilers in six hours anton@mips.complang.tuwien.ac.at (1994-05-19)
Re: Compilers in six hours chase@Think.COM (1994-05-19)
Re: Compilers in six hours hbaker@netcom.com (1994-05-20)
Re: Compilers in six hours monnier@di.epfl.ch (Stefan Monnier) (1994-05-22)
Re: Compilers in six hours munk@prl.philips.nl (1994-05-24)
Re: Compilers in six hours li@marcus.cs.umn.edu (1994-05-24)
Re: Compilers in six hours cytron@kato.wustl.edu (1994-05-25)
Re: Compilers in six hours hobbs@gemmax.zko.dec.com (1994-05-26)
| List of all articles for this month |
Newsgroups: comp.compilers
From: munk@prl.philips.nl (Harm Munk)
Keywords: courses
Organization: Philips Research Laboratories Eindhoven, Netherlands
References: 94-05-018 94-05-061
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.


Regards,
Harm
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.