A CFG is ambiguous if

A CFG is ambiguous if
A. It has more than one rightmost derivations
B. It has more than one leftmost derivations
C. No parse tree can be generated for the CFG
D. None of the mentioned
 
Answer: B
Explanation: A context free grammar is ambiguous if it has more than one parse tree generated or more than one leftmost derivations. An unambiguous grammar is a context free grammar for which every valid string has a unique leftmost derivation.
 

Tìm kiếm

Back
Top