0
$\begingroup$

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!

$\endgroup$

1 Answer 1

0
$\begingroup$

An 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.$$

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.