COMPILER DESIGN

SYNTAX ANALYSIS

ROLE OF THE PARSER

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which phase of the compiler is also known as Scanner?
A
Syntax Analysis
B
Lexical Analysis
C
Semantic Analysis
D
Code generation
Explanation: 

Detailed explanation-1: -The first phase of the compiler is the lexical analyzer, also known as the scanner, which recognizes the basic language units, called tokens.

Detailed explanation-2: -Lexical Analysis: Lexical analysis or Lexical analyzer is the initial stage or phase of the compiler. This phase scans the source code and transforms the input program into a series of a token.

Detailed explanation-3: -Lexical analysis is the starting phase of the compiler. It gathers modified source code that is written in the form of sentences from the language preprocessor. The lexical analyzer is responsible for breaking these syntaxes into a series of tokens, by removing whitespace in the source code.

Detailed explanation-4: -Explanation: Lexical Analyzer is also called “Linear Phase” or “Linear Analysis” or “Scanning“.

Detailed explanation-5: -Lexical analysis is the first phase of a compiler. It takes the modified source code from language pre-processors that are written in the form of sentences. Lexical analyser breaks these syntaxes into a series of tokens.

There is 1 question to complete.