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?
This grammar is ambiguous. The string aabb
can be derived in two different ways:
S => A => aAb => aabb
S => B => aBb => aaBbb => aabb