Pass of Compiler
Again Pass of Compiler is one of the most important topics of the compiler design. we have provided the whole important key point about it in brief. So you can understand wit the easy language
Single and Multi-Pass Compilers (Pass of Compiler)
- One complete scan of a source program called the pass.
- Pass includes reading an input file and writing to the output file.
- In a single pass compiler analysis of the source, the statement is immediately followed by synthesis of equivalent target statement.
- It is difficult to compile the source program into single pass due to:
- A forward reference to a program entity is a reference to the entity which precedes its definition in the program.
- This problem can be solved by postponing the generation of target code until more information concerning the entity becomes available.
- So, It leads to the multi-pass model of compilation.
- In Pass I: Perform analysis of the source program and note relevant information.
- In Pass II: Generate target code using information noted in the pass I.
Effect of reducing the number of passes (Pass of Compiler)
- It is desirable to have a few passes because it takes time to read and write the intermediate file.
- On the other hand, if we group several phases into one pass we may be forced to keep
the entire program in the memory. Therefore the memory requirement may be large.