0

I have the following grammar defined:

S -> A|B, A -> aAb | ab, B -> aBb | epsilon;

After working for some time, I still couldn't find a string to construct a distinctive parse tree to show that this grammar is ambiguous. Like: aaabbb,abab,etc. It seemed like this grammar is unambiguous. Any help?

zihaow
  • 312
  • 2
  • 9
  • 23

1 Answers1

0

This grammar is ambiguous. The string aabb can be derived in two different ways:

S => A => aAb => aabb
S => B => aBb => aaBbb => aabb
MNos
  • 520
  • 6
  • 11