Again freestudy9 comes back with the full information about Pass of Compiler | Pass Compiler | Front end | back end Additionally, we have full Brief Information About Compiler Design.
One complete scan of the 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:
- Forward reference: a forward reference of a program entity is a reference to the entity which precedes its definition in the program.
- Similarly, This problem can solve by postponing the generation of target code until more information concerning the entity becomes available.
- It leads to the multi-pass model of compilation.
- So In Pass I: Perform analysis of the source program and note relevant information.analysis
- So In Pass II: Generate target code using information noted in the pass I.
Effect of reducing the number of passes: Pass Compiler | Front end | Back end
- It is desirable to have a few passes because it takes time to read and write an 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 memory requirement may be large
The phases collected into a front end and back end.
Front-end: Pass Compiler | Frontend | backend
- Moreover, The front end consists of those phases, that depends primarily on source language and largely independent of the target machine.
- Front-end includes lexical analysis, syntax analysis, semantic analysis, intermediate code generation and creation of symbol table.
- A Certain amount of code optimization can be done by the front end.
Back-end: Pass Compiler | Front-end | back-end
- The back end consists of those phases, that depends on a target machine and do not depend on the source program.
- So Backend includes code optimization and code generation phase with necessary error handling and symbol table operation.ling