Re: How does a language compile itself?

mark@omnifest.uwm.edu (Mark Hopkins)
4 Jun 1997 22:53:28 -0400

          From comp.compilers

Related articles
How does a language compile itself? crp333@worldnet.att.net (J KILLEA) (1997-05-17)
Re: How does a language compile itself? dwight@pentasoft.com (Dwight VandenBerghe) (1997-05-22)
Re: How does a language compile itself? pardo@cs.washington.edu (1997-05-22)
Re: How does a language compile itself? walter@bytecraft.com (Walter Banks) (1997-05-25)
Re: How does a language compile itself? dgay@barnowl.CS.Berkeley.EDU (1997-05-30)
Re: How does a language compile itself? cliffc@risc.sps.mot.com (Cliff Click) (1997-06-02)
Re: How does a language compile itself? mark@omnifest.uwm.edu (1997-06-04)
| List of all articles for this month |
From: mark@omnifest.uwm.edu (Mark Hopkins)
Newsgroups: comp.compilers
Date: 4 Jun 1997 22:53:28 -0400
Organization: Omnifest
Keywords: practice

>From crp333@worldnet.att.net (J KILLEA):
> At the "java.sun.com" Web site I noted the statement that the compiler
> for Oak (now evolved into Java) was written in Oak. Not being a CS
> person, I do not understand how this can be...


>From dwight@pentasoft.com (Dwight VandenBerghe):
> It's one of the great joys of programming; you really have to try it
> to understand. Here's the idea. You come up with the simplest, most
> bone-head version of the language that is actually useful, and then
> you write the first version of the compiler in that language...
> and you hand-translate your program into, say, C.


I'm not sure this is the best way to go through the process. There's too
many things that can go wrong, and not enough opportunity to actually test
the design of the language you're compiling to.


A better way is to first test the language design by writing an interpreter
for it (in C or some other existing language). Once you have everything
worked out and you're satisfied with the results, then you can write a
compiler for the language in the language, itself, and then interpret the
compiler compiling itself. The resulting output will be the executable for
the compiler you wrote.


You can test it by compiling the compiler with that executable and comparing
the result to what you got when you used the interpreter.
--


Post a followup to this message

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