Presentation is loading. Please wait.

Presentation is loading. Please wait.

COP4620 – Programming Language Translators Dr. Manuel E. Bermudez

Similar presentations


Presentation on theme: "COP4620 – Programming Language Translators Dr. Manuel E. Bermudez"— Presentation transcript:

1 COP4620 – Programming Language Translators Dr. Manuel E. Bermudez
Bootstrappping COP4620 – Programming Language Translators Dr. Manuel E. Bermudez

2 Bootstrapping Definition Example: A Compiler for C Cross-compiling
Topics Bootstrapping Definition Example: A Compiler for C Cross-compiling

3 Bootstrapping The notion of implementing a language, by means of using (part of) that language’s own implementation. Notation: T-diagram Source Target Language Written in

4 T-diagrams C M APPLICATION Source Coincides Object Coincides Execution

5 Bootstrapping Example: We wish to have a C compiler for a new processor, M. How do we get it ? Possibility #1: Write the compiler directly by hand, in machine language? In assembly language ?  C M

6 Bootstrapping Possibility # 2: Write the C compiler in some other language L, that is already implemented on M. Then, compile the compiler. But, ... this is probably still too much work. L M C M C M L Compiler

7 Bootstrapping Possibility # 3: T M First, implement T, a subset of C.
Now, T is implemented. Then, write the desired compiler in T, and compile it. L M T M T M C M

8 Bootstrapping If T is choosen well, the T  M compiler and the C  M compiler (in T) together, are easier to write than the C  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.

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

10 Bootstrapping Possibility # 4: T M’ Step 1: Same as for M
(implement T on M’). Step 2: Modify the C M compiler, to generate code for M’. Then, compile the compiler. L M’ T M’ T M’ C M’

11 Bootstrapping Possibility # 5 C M’ (cross-compiling):
Don’t use T ! Instead, use implementation of C on M. Step 1: Step 2: Compile the compiler (on M). C M C M’ Cross-compiler C M’ M C M’

12 Bootstrapping Definition Example: A Compiler for C Cross-compiling
summary Bootstrapping Definition Example: A Compiler for C Cross-compiling


Download ppt "COP4620 – Programming Language Translators Dr. Manuel E. Bermudez"

Similar presentations


Ads by Google