COMPUTER SCIENCE AND ENGINEERING
COMPILER DESIGN
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
one LMD and one RMD
|
|
one LMD and more RMD
|
|
one RMD and more LMD
|
|
none
|
Detailed explanation-1: -2. Which of the following are always unambiguous? Explanation: Deterministic CFGs are always unambiguous, and are an important subclass of unambiguous CFGs; there are non-deterministic unambiguous CFGs, however.
Detailed explanation-2: -The leftmost derivation is the one in which you always expand the leftmost non-terminal. The rightmost derivation is the one in which you always expand the rightmost non-terminal.
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: -Derive the string"00101” for left most derivation (LMD) and right most derivation (RMD) using context free grammar (CFG).