|Re: "The C compiler is Written in C" What! email@example.com (Glen Herrmannsfeldt) (2003-07-26)|
|Re: "The C compiler is Written in C" What! firstname.lastname@example.org (Marco van de Voort) (2003-07-31)|
|Re: "The C compiler is Written in C" What! email@example.com (Paul Robinson) (2003-07-31)|
|Re: "The C compiler is Written in C" What! firstname.lastname@example.org (Rinie Kervel) (2003-07-31)|
|Re: "The C compiler is Written in C" What! email@example.com (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! firstname.lastname@example.org (Marco van de Voort) (2003-08-04)|
|From:||Paul Robinson <email@example.com>|
|Date:||31 Jul 2003 12:40:15 -0400|
|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..."
Return to the
Search the comp.compilers archives again.