Compiler Design Unit-1 - 3
Compiler Design Unit-1 - 3
UNIT-1 (Lecture-3)
Example to process as code segment through phases of compiler:
1. Single Pass: If we combine or group all the phases of compiler design in a single module
known as single pass compiler.
In above diagram there are all 6 phases are grouped in a single module, some points of single
pass compiler is as:
1. A one pass/single pass compiler is that type of compiler that passes through the part of each
compilation unit exactly once.
2. Single pass compiler is faster and smaller than the multi pass compiler.
3. As a disadvantage of single pass compiler is that it is less efficient in comparison with
multipass compiler.
4. Single pass compiler is one that processes the input exactly once, so going directly from
lexical analysis to code generator, and then going back for the next read.
Note: Single pass compiler almost never done, early Pascal compiler did this as an introduction.
2. Two Pass or Multi pass: A Two pass/multi-pass Compiler is a type of compiler that
processes the source code or abstract syntax tree of a program multiple times. In multipass
Compiler we divide phases in two pass as:
Portability No Yes