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

S -> S + S

S -> S * S

S -> a

S -> b

Mumbai University > Information Technology > Sem 4 > Automata Theory

Marks : 10M

automata theory • 174 views
 modified 7 weeks ago by RB • 100 written 5 months ago by
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.