edited by
111 views
1 votes
1 votes

A context-free grammar $G$ is ambiguous if and only if

  1. some string $w \in L(G)$ has different leftmost and rightmost derivations.
  2. some string $w \in L(G)$ has at least two different parse trees.
  3. every string $w \in L(G)$ has at least two different parse trees.
  4. some string $w \in L(G)$ has at least two different leftmost derivations.
edited by

2 Answers

Best answer
1 votes
1 votes
A context-free grammar is ambiguous if it has multiple leftmost derivations or parse trees for some input string.

Reference: https://en.wikipedia.org/wiki/Ambiguous_grammar
selected by
0 votes
0 votes

A CFG is ambiguous if one or more terminal strings have multiple leftmost derivations from the start symbol.  Equivalently: multiple rightmost derivations, or multiple parse trees.

Reference:http://infolab.stanford.edu/~ullman/ialc/slides/slides7.pdf

So, the correct answer is $B;D.$

Answer:

Related questions

1 votes
1 votes
2 answers
2