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$
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$
  • 1
    $\begingroup$ Thanks! You helped me a lot! $\endgroup$ – Sebas Belaustegui Dec 15 '19 at 1:34
  • $\begingroup$ You are welcome :) $\endgroup$ – narek Bojikian Dec 15 '19 at 1:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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