Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

What are the types of passes in compiler ?

Types of passes :

  1. Single-pass compiler:
    • Imagine you’re reading a book from start to finish in one go without going back to previous pages.
    • In a single-pass compiler, it reads through your source code once, line by line.
    • As it reads, it breaks down each line into smaller units called tokens (like breaking down a sentence into words).
    • Then, it checks the structure of each line to ensure it follows the rules of the programming language.
    • Finally, it builds a tree-like structure representing the code’s logic and creates tables containing information about each token.
  2. Multi-pass compiler:
    • Picture going through multiple drafts of an essay, each time refining and improving it.
    • In a multi-pass compiler, it goes through your source code multiple times.
    • During each pass, it makes modifications to the code to improve it or prepare it for the next stage.
    • It might perform tasks like optimization, where it makes the code more efficient, or translation, where it converts code into a lower-level language.
    • Each pass might focus on different aspects of the code until it’s ready to generate the final object code.

Leave a Comment