LEXICAL ANALYSIS
ROLE OF THE LEXICAL ANALYZER
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
T1T2T3
|
|
T1T1T3
|
|
T2T1T3
|
|
T3T3
|
Detailed explanation-1: -The lexical analyzer is responsible for removing the white spaces and comments from the source program. It corresponds to the error messages with the source program. It helps to identify the tokens. The input characters are read by the lexical analyzer from the source code.
Detailed explanation-2: -Explanation: The process of forming tokens from an input stream of characters is called tokenization. 2. When expression sum=3+2 is tokenized then what is the token category of 3? Sum “Identifier” = “Assignment operator” 3 “Integer literal” + “Addition operator” 2 “Integer literal”; “End of statement".
Detailed explanation-3: -Lexical analyzer recognizes the lexemes (alphanumeric characters in a token ) and recognize the white spaces, comments, tab and ignore them.
Detailed explanation-4: -Lexical Analysis is the first phase of compiler also known as scanner. It converts the High level input program into a sequence of Tokens. Counting all the boxes, the total number of tokens comes out to be 26.