Passes in Compiler
A compiler has two different passes to move across the source program.
- Multi-pass Compiler
- One-pass Compiler
Multi-pass Compiler
- A multipass compiler runs the source code several times.
- The compiler reads the source code, scans it, extracts the tokens and stores the result in an output file during the first pass.
- The compiler reads the output file produced by the first pass and then builds the syntactic tree and performs the syntactical analysis. The output is a file that contains the syntactic tree during the second pass
- These passes are repeated until the required output is produced.
One-pass Compiler
- A Onepass compiler runs the source code only one time.
- Each unit is translated into final machine code
- When the source code is processed, it is scanned and then the token is extracted.
- The tree structure is built after analysing the syntax in each line. The code is generated after the semantic part
- This process is repeated for each and every line until the program is compiled
Reference Link
