0
$\begingroup$

I want to remove the epsilon transition from following grammar: \begin{eqnarray} S & \rightarrow & A | B \\ A & \rightarrow & \epsilon \\ B & \rightarrow & aBa \\ B & \rightarrow & b \\ \end{eqnarray} This is the result of removing $\epsilon$ transition: \begin{eqnarray} S & \rightarrow & \epsilon | B \\ B & \rightarrow & aBa \\ B & \rightarrow & b \end{eqnarray}

My question is what's the difference between languages that accept these two grammars?

$\endgroup$
  • $\begingroup$ If you followed the algorithm, there is provably no difference. Try proving that. $\endgroup$ – Raphael Nov 19 '17 at 11:27
1
$\begingroup$

There is no difference. Both grammars describe the same language $$L = \{ \epsilon \} \cup \{ a^nba^n | \forall n > 0\}.$$

$\endgroup$
0
$\begingroup$

No difference. You can't re-choose the terminal $A$ after choosing it even once in your example.

$\endgroup$

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.