Machine-translated by Google. Questions are authored in English.
Top

Discussion

A grammar is ambiguous when

  • A.some sentence of its language has more than one parse tree
  • B.some production has more than one symbol on its right hand side
  • C.two different nonterminals derive the same set of strings
  • D.one of its rules happens to be recursive on the left

Answer: A

Correct answer: some sentence of its language has more than one parse tree

Ambiguity is a property of the grammar rather than of the language: it means one sentence can be given two different structures, so the grammar does not determine the meaning. Recursion and multi-symbol right sides are ordinary and harmless; it is the existence of a second tree for one sentence that is the fault.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.