Re: "The C compiler is Written in C" What!

Paul Robinson <postmaster@paul.washington.dc.us>
31 Jul 2003 12:40:15 -0400

          From comp.compilers

Related articles
Re: "The C compiler is Written in C" What! gah@ugcs.caltech.edu (Glen Herrmannsfeldt) (2003-07-26)
Re: "The C compiler is Written in C" What! marcov@toad.stack.nl (Marco van de Voort) (2003-07-31)
Re: "The C compiler is Written in C" What! postmaster@paul.washington.dc.us (Paul Robinson) (2003-07-31)
Re: "The C compiler is Written in C" What! rinie@xs4all.nl (Rinie Kervel) (2003-07-31)
Re: "The C compiler is Written in C" What! gah@ugcs.caltech.edu (Glen Herrmannsfeldt) (2003-08-04)
Re: "The C compiler is Written in C" What! Martin.Ward@durham.ac.uk (Martin Ward) (2003-08-04)
Re: "The C compiler is Written in C" What! marcov@toad.stack.nl (Marco van de Voort) (2003-08-04)
| List of all articles for this month |

From: Paul Robinson <postmaster@paul.washington.dc.us>
Newsgroups: comp.compilers
Date: 31 Jul 2003 12:40:15 -0400
Organization: Elusive-Butterfly.net
References: <43797288.0307260936.7ea8822c@posting.google.com> 03-07-198
Keywords: practice
Posted-Date: 31 Jul 2003 12:40:14 EDT

Glen Herrmannsfeldt wrote:


> It is usual to write a compiler in the language that it compiles. If
> existing compilers exist, the first compiler can be compiled on
> another compiler (possibly on another machine), and then the result
> used to compile the new one.
>
> If no existing compilers exist, a simple (subset) compiler is written
> in another language to compile a simple version of the new one, and
> slowly add to it.
>
> While C compilers written in C are common, I do know of at least one
> Fortran compiler written in Fortran. That is not so common.
>
> There are a number of good books on compiler design that will explain this.


This practice is extremely common for Pascal compilers. But it also
begs the question where they come from.


Nicklaus Wirth has stated that because they were developing on a CDC
machine, the original Pascal compiler had to be written in FORTRAN.
(CDC is really big on FORTRAN, their compiler for it has lots of tools
and support routines.)


Once the compiler could be completed, subsequent compilers for Pascal
were then written in the target language itself.


While it cannot compile itself, the subset Facillis Pascal compiler
(written by Wirth) is written in Pascal.


The UCSD Pascal compiler is written in itself and is self-compilable.


Back when it was the National Bureau of Standards, they contracted to
have a Pascal compiler written for the PDP/11 Series of computers. It
is a two-pass compiler (the PDP/11 is not very big) and is written
itself in Pascal.


A Pascal compiler for IBM 370 mainframes which was developed at
several places including the Australian Atomic Energy Commission
(AAEC), is itself a 5600-line Pascal program, plus about the same
amount of IBM-370 BAL (Assembly language).


The Free Pascal Compiler is entirely written in Pascal except for
run-time routines which require assembly.


Legend has it that Microsoft originally wrote a FORTRAN Compiler using
Pascal. Apparently that was a one-time thing, my understanding is
only C is used for creating compilers there now.


--
Paul Robinson "Above all else... We shall go on..."


Post a followup to this message

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