0% found this document useful (0 votes)
46 views12 pages

Bootstrapping: Programming Language Translators

Bootstrapping is the process of implementing a programming language by using that same language as the implementation language. This document discusses several possibilities for bootstrapping a Pascal compiler from one machine to another. Specifically, it describes writing a subset of Pascal called P, using P to write the full Pascal compiler, then modifying that compiler to target a new machine. This multi-step process avoids rewriting the compiler from scratch each time.

Uploaded by

Jyoti Tripathi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views12 pages

Bootstrapping: Programming Language Translators

Bootstrapping is the process of implementing a programming language by using that same language as the implementation language. This document discusses several possibilities for bootstrapping a Pascal compiler from one machine to another. Specifically, it describes writing a subset of Pascal called P, using P to write the full Pascal compiler, then modifying that compiler to target a new machine. This multi-step process avoids rewriting the compiler from scratch each time.

Uploaded by

Jyoti Tripathi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 12

Bootstrapping

Programming Language Translators

Prepared by

Manuel E. Bermdez, Ph.D.


Associate Professor University of Florida

Bootstrapping
The notion of implementing a language, by means of using (part of) that languages own implementation. Notation: T-diagram

Source
Language Written in

Target

Bootstrapping
Diagram Purpose:
APPLICATION C C M Source Coincides Object Coincides M APPLICATION M

Execution

Bootstrapping
Example: We wish to have a Pascual compiler for a new Processor, M.

M M

How do we get it ?

Possibility #1: Write the compiler directly by hand, in machine language? In assembly language ?

Bootstrapping
Possibility # 2: Write the Pascal compiler in some other language L, that is already implemented on M. Then, compile the compiler.
P M P M

L M

L Compiler

But, ... this is probably too much work.

Bootstrapping
Possibility # 3: First, implement P, a subset of Pascal. Then, write the desired compiler in P, and compile it. Step 1:
P L M L M P M M

Now P is implemented.

Bootstrapping
Step 2:
Pascal P Write this P M M Pascal M M

If P is choosen well, the P -> M compiler and the Pascal -> M compiler (in P) together, are easier to write than the Pascal -> M (in L) compiler. Theoretically, this process can go on indefinitely, bootstrapping up the level of the language. In practice, however, new constructs interfere with each other (and with old ones), until further bootstrapping becomes ummanageable

Bootstrapping
Example: Now, lets suppose we wish to port Pascal to a new machine, M. Possibility #1: Same as for M. Possibility #2: Same as for M. Possibility #3: Same as for M.

Bootstrapping
Possibility #4: Step 1: Same as for M (implement P on M). Step 2: Modify the Pascal compiler.
Pascal P M By hand

Pascal P P

Pascal
M M M

Bootstrapping
Possibility #5: Dont use P! Use the implementation of Pascal on M instead. Step 1:
Pascal P M

By hand

Pascal Pascal

Pascal M M

Pascal

Bootstrapping
Step 2:
Pascal Pascal By hand M Pascal M Pascal M M M

Note: Possibility #5 is called cross-compiling.

Bootstrapping
Many compilers undergo a long chain of bootstrapping steps. For example, XPL (a dialect of PL/I), was written first in Algol, then in XPL, and ported to a B5500 and then an IBM 360. Eight bootstraping steps were required.

You might also like