A presentation of Compiler Design on the topic Passes. It include one pass, two pass and multi-pass. It also include comparison between single pass and multi-pass compiler and use cases of both the compiler.
Size: 575.41 KB
Language: en
Added: Jan 31, 2023
Slides: 9 pages
Slide Content
Compiler Passes PRESENTATION BY • Sanjay sINGH
Agenda Pass Single Pass Compiler Two Pass Compiler Multi Pass Compiler Comparisons Conclusion
Pass A pass refers to the traversal of a compiler through the entire program. Pass is a group of phases implemented together. Majorly , there are three types of compilers: Single Pass Compilers Two Pass Compilers Multi Pass Compilers
Single Pass Compiler When we merge all the phases of compiler design in a single module, then it is called a single pass compiler. A single pass compiler runs the source code only one time. In single pass Compiler source code directly transforms into machine code. It is also called a "Narrow compiler . It has limited scope
Two Pass Compiler A processor that runs through the program to be translated twice is considered a two-pass compiler. First Pass : is refers as Front End Analytic Part Platform Independent Second Pass : is refers as Back End S ynthesis Part Platform Dependent
Multi Pass Compiler The multi-pass compiler processes the source code several times. It divided a large program into multiple small programs and process them. It develops multiple intermediate codes. All of these multi-pass take the output of the previous phase as an input. It is also known as ‘Wide Compiler ’. As it can scan every portion of the program.
Comparisons Single Pass compiler Uses more space than multi pass compilers. Faster than multi pass as there is no reading and writing of intermediate files. Less efficient code optimization and code generation. Example – Pascal & Tiny C Multi pass compiler Uses less space than single pass compilers. Slower than single pass compiler, due to reading and writing of intermediate files. Better code optimization and code generation. Example – Java, GCC
Conclusion If we want to design a compiler for different programming language for same machine, there is requirement of making Front end/first pass for each of them and only one Back end/second pass. If we want to design a compiler for same programming language for different machine/system, we make different Back end for different Machine/system and make only one Front end for same programming language.