Hi im stuck on an exercise of ambiguous grammar. I need an example that shows that this grammar is ambiguous. The grammar is defined as follows:
$$S \rightarrow aT | bR$$ $$R \rightarrow a | aS | bRR$$ $$T \rightarrow b | bS | aTT$$
Thanks!
Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. It only takes a minute to sign up.
Sign up to join this communityAn example is the word $aabbab$.
We can either create it like this $$S \rightarrow aT \rightarrow aaTT \rightarrow aabST \rightarrow aabbRT \rightarrow aabbaT \rightarrow aabbab.$$ Or like this $$S \rightarrow aT \rightarrow aaTT \rightarrow aabT \rightarrow aabbS \rightarrow aabbaT \rightarrow aabbab.$$