0
$\begingroup$

How to remove left recursion in the following Grammar:

S→Bb/a
B→Bc/Sd/e

Im new to this, below is the way I'm doing it:

S-> Sd/a
B-> Bc/Bb/e

I replaced the values of S and B with Bb and Sd to make the grammar easier to deal with. Then:

S-> aS'
S'-> dS' / ε

Is this the correct approach to do this ?

$\endgroup$
2
  • $\begingroup$ Now do the same for $B$. $\endgroup$
    – vonbrand
    May 6 at 18:09
  • $\begingroup$ @vonbrand B-> eB' B'-> cB' / dB' / ε Is this the correct way of doing this? Someone told me that I cant replace the values of S and B with Bb and Sd. $\endgroup$
    – whoAsked
    May 7 at 14:59

0

Your Answer

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