LEXICAL ANALYSIS
ROLE OF THE LEXICAL ANALYZER
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
The grammar contains non-terminals
|
|
Produces more than one parse tree
|
|
Production has two non-terminals side by side
|
|
None of the mentioned
|
Detailed explanation-1: -A Context Free Grammar is called ambiguous grammar if it produces more than one parse tree (derivation tree) or when more than one left most derivation or right most derivation for the same sentence or input.
Detailed explanation-2: -A context-free grammar is called unambiguous grammar if there exists one and only one derivation tree or parse tree. Hence the correct answer is Ambiguous.
Detailed explanation-3: -A grammar for which there are two different parse trees for the same terminal string is said to be ambiguous. We can prove this grammar is ambiguous by demonstrating two parse trees for the same terminal string.
Detailed explanation-4: -Explanation: A context free grammar is ambiguous if it has more than one parse tree generated or more than one leftmost derivations. An unambiguous grammar is a context free grammar for which every valid string has a unique leftmost derivation.
Detailed explanation-5: -If a context free grammar G has more than one derivation tree for some string w ∈ L(G), it is called an ambiguous grammar. There exist multiple right-most or left-most derivations for some string generated from that grammar.