COMPUTER SCIENCE AND ENGINEERING
COMPILER DESIGN
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
ambiguous
|
|
unambiguous
|
|
partially ambiguous
|
|
none
|
Detailed explanation-1: -A Grammar that makes more than one Leftmost Derivation (or Rightmost Derivation) for the similar sentence is called Ambiguous Grammar. Example − Verify whether the following Grammar is Ambiguous or Not. For string id + id * id, there exist two parse trees.
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: -The correct answer is option 4. A is ambiguous because can be generated using leftmost derivation having two different parse trees with an empty string. B is ambiguous grammar with string abab. C is an ambiguous grammar with string abbbb.
Detailed explanation-4: -All right linear languages are regular, so they are all unambiguous.