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
ADD COMMENTlink
modified 7 weeks ago by gravatar for RB RB100 written 5 months ago by gravatar for pratikj2208 pratikj22080
0

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.

ADD COMMENTlink
modified 6 weeks ago by gravatar for Ankit Pandey Ankit Pandey60 written 7 weeks ago by gravatar for RB RB100
Please log in to add an answer.