COMPUTER SCIENCE AND ENGINEERING
THEORY OF COMPUTATION
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
two or more productions have the same non-terminal on the left hand side
|
|
a derivation tree has more than one associated sentence
|
|
there is a sentence with more than one derivation tree corresponding to it
|
|
brackets are not present in the grammar
|
Detailed explanation-1: -A grammar is said to be ambiguous if there exists more than one leftmost derivation or more than one rightmost derivation or more than one parse tree for the given input string. If the grammar is not ambiguous, then it is called unambiguous. If the grammar has ambiguity, then it is not good for compiler construction.
Detailed explanation-2: -A grammar is said to be ambiguous if there exists more than one left most derivation or more than one right most derivation or more than one parse tree for a given input string. If the grammar is not ambiguous then we call it unambiguous grammar.
Detailed explanation-3: -A grammar is ambiguous if it has more than one leftmost derivations for a sentence. That’s equivalent to saying that it had more than one rightmost derivation for the same sentence because the is a one-to-one correspondence between leftmost and rightmost derivations.
Detailed explanation-4: -Ambiguous grammar: A Context-free grammar is said to be ambiguous if there exists more than one derivation tree for the given input string i.e., more than one LeftMost Derivation Tree (LMDT) or RightMost Derivation Tree (RMDT).
Detailed explanation-5: -Definition. A grammar is ambiguous if there exists a sequence of token that can be derived by two different leftmost derivations. An obvious question is whether there is a better, unambiguous, grammar for simple expressions.