53.0k views
1 vote
Which among the following choices is correct based on the two statements listed below? Statement 1: When the lexical analyzer scans ‘int’ and ‘intvalue’, it is not able to decide whether the int leads to a keyword or an identifier. Statement 2: Longest Match Rule. a. Statement 1 is an assertion, Statement 2 is the reason. b. There is no such Statement 2. c. This is a function of the Syntax Analyzer. d. Statement 1 is an assertion, Statement 2 is the solution. e. This is not a function of the Lexical Analyzer.

1 Answer

3 votes

Answer: d. Statement 1 is an assertion, Statement 2 is the solution.

Step-by-step explanation:

The Longest Match rule is a rule which states that whichever lexeme is scanned should always be determined on the support of the longest match available among all the tokens which is accessible. The lexical analyzer used should also follow the rules arrangement, where a reserved word, e.g., a keyword, in a language is given priority over the user input.

User Calen
by
5.1k points