0
2.0kviews
What is ambiguous grammar ? Find if the following grammar is ambigous or not ?

S -> S + S

S -> S * S

S -> a

S -> b

Mumbai University > Information Technology > Sem 4 > Automata Theory

Marks : 10M

1 Answer
0
24views

S $\rightarrow$ S + S

S * S

a

b

Consider derivation of A + b + a * b


LMD

enter image description here

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

enter image description here

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.