retagged by
1,448 views

3 Answers

Best answer
6 votes
6 votes
If any CFG $G$ has at least one String such that for that String, we have either

1. Two or more Right Most Derivation then $G$ is ambiguous.

or

2. Two or more left most Derivation then $G$ is ambiguous

or

3. Two or more Parse Tress (Derivation Trees) then $G$ is ambiguous.
selected by
3 votes
3 votes

A grammar is called ambiguous grammar if it has

  1. 2 or more Left most derivation (LMD)
  2. 2 or more Right most derivation (RMD)

Why grammar becomes ambiguous?  Its because whenever the compiler sees 2 or more possibilities to derive the same string(either via LMD or RMD) then it gets confused which one to choose to derive the string.

0 votes
0 votes
For , proving a grammar to be ambiguous , we should have at least one string generated by the grammar such that the string has:

1-> more than one parse tree.

2-> 2 or more than 2 right most derivations .

3-> 2 or more than 2 left most derivations.

 Any of  the three would suffice.

Related questions

1 votes
1 votes
1 answer
1
1 votes
1 votes
2 answers
2
Prateek Arora asked Oct 27, 2016
629 views
Is the given grammar ambiguous?S->ABA->aB->b
2 votes
2 votes
1 answer
3
learner_geek asked Aug 5, 2017
991 views
Make this grammer into unambiguous
1 votes
1 votes
1 answer
4
learner_geek asked Aug 2, 2017
571 views
If i am wrong please let me correct with giving proper explanation.