How to remove left recursion in the following Grammar:


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 ?

  • $\begingroup$ Now do the same for $B$. $\endgroup$
    – vonbrand
    May 6, 2023 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, 2023 at 14:59
  • $\begingroup$ The custom is to use | where you're writing /. $\endgroup$ Jan 10 at 9:51

1 Answer 1

  • $\begingroup$ We're not looking for an answer that just contains a grammar. We would like to see explanation, justification, etc. $\endgroup$
    – D.W.
    Jan 10 at 8:29

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.