Re: Compilers in six hours

chase@Think.COM (David Chase)
Tue, 17 May 1994 18:33:11 GMT

          From comp.compilers

Related articles
compilers, in a nutshell (1994-05-09)
Compilers in six hours (1994-05-12)
Re: Compilers in six hours chase@Think.COM (1994-05-17)
Re: Compilers in six hours (1994-05-17)
Re: Compilers in six hours (1994-05-18)
Compilers in six hours (1994-05-18)
Compilers in six hours (1994-05-19)
Re: Compilers in six hours (1994-05-19)
Re: Compilers in six hours chase@Think.COM (1994-05-19)
[6 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers
From: chase@Think.COM (David Chase)
Keywords: courses, comment
Organization: Thinking Machines Corporation, Cambridge MA, USA
References: 94-05-018 94-05-037
Date: Tue, 17 May 1994 18:33:11 GMT

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.

The reasons for this are:

1. You should be studying Scheme, anyway, since it is (my opinion) the
      smallest language with "interesting" semantics (garbage-collection,
      first class functions, continuations, bignums -- you can go far in
      Scheme) that is widely used.

2. Many "compilers" nowadays are written in terms of translation to C.

3. Scheme allows you to avoid reinventing the wheel (badly) when
      constructing your own "little language". Why shouldn't a "little
      language" have all the semantic features of Scheme? It's not likely
      that someone tossing off a quickie language implementation is going to
      get improved performance by not using Scheme (i.e., there's a lot of
      time spent making Scheme go not-quite-as-fast-as-C, but faster than
      your average hack interpreter).

4. In a longer class, I can imagine first writing translation to Scheme,
      then translation to C, and finally translation to machine language,
      with each step increasing the amount of detail that the compiler must
      track. It might be entertaining to write three compilers for the same
      language in this fashion, and see which one produced the fastest result.

      Doing the course in this fashion would also give you a road-map for
      when features are introduced.

5. In many instances, the "little languages" that people "design" have
      such disgusting syntax that the world would be a better place if they
      were replaced with Scheme (plus relevant special-purpose primitives),
      parentheses and all. I'm thinking in particular of sendmail
      configuration files and adb scripts.

6. Actually doing a good job of machine-language generation nowadays is
      probably nasty enough to justify a course in itself.

I think a case could also be made for compilation to Postscript, though
using a printer as a compute server seems a little silly.

David Chase, speaking for myself
Thinking Machines Corp.
[Compiling to Postscript is a swell idea. My copy of MS Word does it to
my documents all the time. So does dvips. -John]

Post a followup to this message

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