How can I prove that this grammar is ambiguous?

S -> bA|aB
A -> a|aS|bAA
B -> b|bS|aBB

Any simple method besides trying to find a string that will generate two parsing trees?

Can someone please give me a line that can prove it.

+5
source share
2 answers

There is no simple method of proving the ambiguity of context-free grammar - in fact, the question is insoluble , by reducing it to a problem with correspondence .

+5
source

There is a line: bbaaba

S -> bA -> bbAA -> bbaA -> bbaaS -> bbaabA -> bbaaba
S -> bA -> bbAA -> bbaSA -> bbaaBA -> bbaabA -> bbaaba
+16
source

All Articles