Which of the following is the first phase of compiler which is also termed as scanning?

Which of the following is the first phase of compiler which is also termed as scanning? Correct Answer Lexical analysis

The correct answer is option 4.

Concept:

The first phase of the compiler's scan of the source code is lexical analysis. This process can be repeated from left to right, character by character, and these characters can be grouped into tokens. By recognizing the tokens, the character stream from the source program is sorted into meaningful sequences. It enters the matching tickets into the symbol table and moves the token to the next phase.

Functions of Lexical analysis:

  • Recognize the lexical units in the source code.
  • Classify lexical units into classes such as constants and reserved words and enter them into various tables. It will disregard comments in the source code.
  • Identify a token that is not in the language.

Hence the correct answer is Lexical analysis.

Additional Information [ alt="F1 Harshita Madhuri 14.02.2022 D1" src="//storage.googleapis.com/tb-img/production/22/02/F1_Harshita_Madhuri_14.02.2022_D1.png" style="width: 341px; height: 386px;">

Related Questions