Define Passes in compiler

Pass is a complete traversal of the source program. Compiler pass are two types: 

  • Single Pass Compiler or One Pass Compiler 
  • Two Pass Compiler or Multi Pass Compiler. 

one-pass compiler is a compiler that passes through the parts of each compilation unit only once, immediately translating each part into its final machine code.
A multi-pass compiler is a type of compiler that processes the source code or abstract syntax tree of a program several times. This is in contrast to a one-pass compiler, which traverses the program only once. Each pass takes the result of the previous pass as the input, and creates an intermediate output. In this way, the (intermediate) code is improved pass by pass, until the final pass produces the final code.

Leave a Reply