Contents    Prev    Next    Page+10   

A grammar is Ambiguous if:

  • A: the same nonterminal appears twice on the right side of some production
  • B: there are two productions with the same nonterminal on the left side
  • C: there are two derivations of some sentence
  • D: there is some string with two distinct parse trees
  • E: the right side of some production has more than one nonterminal

    Answer:   D

    This is the definition of ambiguous language; it means that some sentence(s) can be understood to have multiple different meanings. For example, in "Police help dog bite victim", did the police help the victim, or did the police also bite?

    C is not correct because different derivations can depend only on the order in which nonterminals are replaced, even though the parse tree and meaning are the same.