Wirth attempted to write a simple language to write the real Pascal compiler. One fatal
flaw was that the simpler language lacked recursion, which was optional in those days, and
the use of the Pascal-0 was abandoned. The next attempt was to write the compiler in
Pascal and ``desk’’ compile it into machine code. That was amazingly successful, if
tedious.
Later, to make porting easier, the good professor wrote a version that generated a stack
based intermediate code called P-code. You could get a copy of the compiler in Pascal and
P-code, write your own P-code interpreter and have a Pascal compiler. It was easy. Pascal
compilers spread like locus after that. One could then change the compiler to write
machine code for the actual machine, although many just extended their P-code emulators.
It was “compile once, run anywhere” long before Java’s virtual machine.
BCPL came the same way, with a version of the compiler in CINIT code to move the compiler.
The PCC required a donor machine already running Unix in somewhat close proximity to the
target machine.
Brantley Coile
On Jun 30, 2016, at 1:17 PM, Nelson H. F. Beebe
<beebe(a)math.utah.edu> wrote:
Ori Idan <ori(a)helicontech.co.il> asks today:
> Pascal compiler written in Pascal? how can I
compile the compiler it I
> don't yet have a pascal compiler? :-)
You compile the code by hand into assembly language for the CDC
6400/6600 machines, and bootstrap that way: see
Urs Ammann
On Code Generation in a PASCAL Compiler
http://dx.doi.org/10.1002/spe.4380070311
Niklaus Wirth
The Design of a PASCAL Compiler
http://dx.doi.org/10.1002/spe.4380010403
It has been a long time since I read those articles in the journal
Software --- Practice and Experience, but my recollection is that they
wrote the compiler in a minimal subset of Pascal needed to do the job,
just to ease the hand-translation process.
-------------------------------------------------------------------------------
- Nelson H. F. Beebe Tel: +1 801 581 5254 -
- University of Utah FAX: +1 801 581 4148 -
- Department of Mathematics, 110 LCB Internet e-mail: beebe(a)math.utah.edu -
- 155 S 1400 E RM 233 beebe(a)acm.org beebe(a)computer.org -
- Salt Lake City, UT 84112-0090, USA URL:
http://www.math.utah.edu/~beebe/ -
-------------------------------------------------------------------------------