0% found this document useful (0 votes)
767 views2 pages

Bootstrapping in Compiler Design

Bootstrapping is a process where a simple language is used to translate a more complex program, which can then translate an even more complex program. This allows writing compilers without having to build them from scratch. For example, to create a compiler for a new language X that generates code for language Z, an existing compiler for language Y that generates code for machine language M could be used to first compile the X to Z compiler into an executable that runs on M. The compiled X to Z compiler could then be used to compile X programs into Z code.

Uploaded by

Aashutosh Tiwari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
767 views2 pages

Bootstrapping in Compiler Design

Bootstrapping is a process where a simple language is used to translate a more complex program, which can then translate an even more complex program. This allows writing compilers without having to build them from scratch. For example, to create a compiler for a new language X that generates code for language Z, an existing compiler for language Y that generates code for machine language M could be used to first compile the X to Z compiler into an executable that runs on M. The compiled X to Z compiler could then be used to compile X programs into Z code.

Uploaded by

Aashutosh Tiwari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Bootstrapping in Compiler Design

Bootstrapping is a process in which simple language is used to translate more complicated


program which in turn may handle for more complicated program. This complicated program
can further handle even more complicated program and so on.
Writing a compiler for any high level language is a complicated process. It takes lot of time to
write a compiler from scratch. Hence simple language is used to generate target code in
some stages. to clearly understand the Bootstrapping technique consider a following
scenario.
Suppose we want to write a cross compiler for new language X. The implementation
language of this compiler is say Y and the target code being generated is in language Z.
That is, we create XYZ. Now if existing compiler Y runs on machine M and generates code
for M then it is denoted as YMM. Now if we run XYZ using YMM then we get a compiler
XMZ. That means a compiler for source language X that generates a target code in
language Z and which runs on machine M.

Following diagram illustrates the above scenario.


Example:
We can create compiler of many different forms. Now we will generate.

Compiler which takes C language and generates an assembly language as an output with
the availability of a machine of assembly language.
 Step-1: First we write a compiler for a small of C in assembly language.

 Step-2: Then using with small subset of C i.e. C0, for the source language c the
compiler is written.

 Step-3: Finally we compile the second compiler. using compiler 1 the compiler 2 is


compiled.
 Step-4: Thus we get a compiler written in ASM which compiles C and generates
code in ASM.

You might also like