Which phase during compilation does a compiler recognize the keywords of a language?
Which phase during compilation does a compiler recognize the keywords of a language? Correct Answer Lexical analysis
Answer: Option (2) Lexical Analysis
Lexical Analysis is the first phase of compilation also known as Scanner. In Lexical analysis, there is Lexical Analyser which will divide the given program into Tokens.
In any program, keywords, constants, identifiers, strings, numbers, operators, and punctuations symbols can be considered as tokens.
For example:
main () { int x = 5;
x = x + 5;
return 0;
}
In the above code, there are 19 tokens and in which there are 3 tokens that are formed from 3 different keywords.
"main", "int", "return" are considered as single single token.
মোঃ আরিফুল ইসলাম
Feb 20, 2025