Question: What is ambiguous grammar ? Find if the following grammar is ambigous or not ?

0

0

S $\rightarrow$ S + S

S * S

a

b

Consider derivation of A + b + a * b

**LMD**

S $\rightarrow$ S + S

S + S + S

A + s + s

A + b + s

A+ b + s * s

A + b + a * s

A + b + a * b

**RMD**

S $\rightarrow$ S + S

S * b

S + s * b

S + a * b

S + s + a * b

S + b + a * b

A + b + a * b

As above both trees are different. The given grammar is ambiguous.

Please log in to add an answer.