COMPILER DESIGN

SYNTAX ANALYSIS

ROLE OF THE PARSER

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
which of the following is always ambiguous
A
one LMD and one RMD
B
one LMD and more RMD
C
one RMD and more LMD
D
none
Explanation: 

Detailed explanation-1: -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-2: -A grammar is said to be ambiguous if it can produce more than one parse tree for a string or when two different sequences of leftmost (or rightmost) derivations can produce the same string from the same start symbol.

Detailed explanation-3: -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.

There is 1 question to complete.