SYNTAX ANALYSIS
ROLE OF THE PARSER
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
Ambiguous
|
|
Context free grammer
|
|
Context sensitive
|
|
Unambiguous
|
Detailed explanation-1: -Ambiguous Grammars 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-2: -The correct answer is option 2. Concept: A grammar that produces more than one parse tree for some sentence is said to be ambiguous.
Detailed explanation-3: -If a string has more than one parse tree in a given grammar, that grammar is called ambiguous.
Detailed explanation-4: -A grammar in which multiple rightmost (or leftmost) derivations exist for a sentence is called an ambiguous grammar. An ambiguous grammar can produce multiple derivations and multiple parse trees.