/    /  Compiler Design-Passes in Compiler

Passes in Compiler

 

A compiler has two different passes to move across the source program. 

  • Multi-pass Compiler
  • One-pass Compiler

 

Multi-pass Compiler

 

  1. A multipass compiler runs the source code several times.
  2. The compiler reads the source code, scans it, extracts the tokens and stores the result in an output file during the first pass.
  3. 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
  4. These passes are repeated until the required output is produced.

 

One-pass Compiler

 

  1. A Onepass compiler runs the source code only one time.
  2. Each unit is translated into final machine code
  3. When the source code is processed, it is scanned and then the token is extracted.
  4. The tree structure is built after analysing the syntax in each line. The code is generated after the semantic part
  5. This process is repeated for each and every line until the program is compiled

 

Reference Link

Passes in Compiler