[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: beagle compiler



"Paul Schlyter" <pausch@saaf.se> wrote in message 
news:eegbes$2o3q$1@merope.saaf.se...
> Now - how does one get the very first version of a self-hosting compiler 
> to work?   :-)

If your name is Steve Wozniak, you toggle it in using switches on the 
motherboard!  :-)

For the rest of us, the assumption is that there is already *something* (not 
necessarily a compiler) already available.

When I was first learning about Pascal around 30 years ago (when it was 
still shiny and new), it was the first time I had heard about a 
language/compiler written in itself. The details are more than a little 
vague by now but the process went something like this.

Using the M4 macro processing language, a simple "compiler" (really just a 
translator) is created which can "compile" a VERY simple form of the 
Pascal(??) language. It may have just translated it into some other language 
or maybe into assembler code - as I said, it's been a while!

Using the simplified Pascal, write a real but still limited compiler which 
can compile most of Pascal. The compiler can be slow and and no output code 
optimisation is needed. In an ideal world it would only be run once!

Using the "once-off" compiler, compile the real/final Pascal compiler. From 
this point, further modifications can be made using the "existing" version 
of the compiler.

I may be misremembering the details of the actual process. But I remember 
for sure that it started with M4, there was a simplified version of Pascal 
in the middle, and the final Pascal compiler was itself written in Pascal.

-- 
Peter Watson
-- Write to MSDOS disks on the Apple IIgs?
-- Impossible!  ;-)