Javatpoint Logo
Javatpoint Logo

Compiler Passes

Pass is a complete traversal of the source program. Compiler has two passes to traverse the source program.

Multi-pass Compiler

  • Multi pass compiler is used to process the source code of a program several times.
  • In the first pass, compiler can read the source program, scan it, extract the tokens and store the result in an output file.
  • In the second pass, compiler can read the output file produced by first pass, build the syntactic tree and perform the syntactical analysis. The output of this phase is a file that contains the syntactical tree.
  • In the third pass, compiler can read the output file produced by second pass and check that the tree follows the rules of language or not. The output of semantic analysis phase is the annotated tree syntax.
  • This pass is going on, until the target output is produced.

One-pass Compiler

  • One-pass compiler is used to traverse the program only once. The one-pass compiler passes only once through the parts of each compilation unit. It translates each part into its final machine code.
  • In the one pass compiler, when the line source is processed, it is scanned and the token is extracted.
  • Then the syntax of each line is analyzed and the tree structure is build. After the semantic part, the code is generated.
  • The same process is repeated for each line of code until the entire program is compiled.

  • Next TopicBootstrapping




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA