Professional Documents
Culture Documents
Bootstrapping in Compiler Design
Bootstrapping in Compiler Design
Prepared by
Bootstrapping
The notion of implementing a language, by means of using
(part of) that languages own implementation.
Notation: T-diagram
Source
Target
Language
Written in
Bootstrapping
Diagram Purpose:
APPLICATION
C
APPLICATION
C
M
Object Coincides
Source Coincides
Execution
Bootstrapping
Example: We wish to have a Pascual compiler for a new
Processor, M.
How do we get it ?
M
M
Bootstrapping
Possibility # 2: Write the Pascal compiler in some other
language L, that is already implemented on M. Then,
compile the compiler.
P
L
M
M
M
M
L Compiler
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
M
Now P is implemented.
M
M
Bootstrapping
Step 2:
Pascal
P
Write this
Pascal
M
P
M
M
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
M
By hand
Pascal
Pascal
M
P
M
M
M
M
Bootstrapping
Possibility #5: Dont use P! Use the
implementation of Pascal on M instead.
Step 1:
Pascal
M
By hand
Pascal
Pascal
M
Pascal
Pascal
M
M
M
M
Bootstrapping
Step 2:
Pascal
Pascal
By hand
Pascal
M
Pascal
M
M
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.