# Why does left recursion have to be eliminated? [closed]

For example,

Let the Grammar be:

S->Sa|B


Thus, S->Sa->Saa->...->Saa...aaa->Baa...aaa

What's wrong with this?

Why is right recursion a solution to the problem?

S->BS'
S->aS'|e

• Who is saying left recursion is a problem? Then right recursion can be one too, since this is symmetrical. Maybe it depends on what you are doing with the grammar. Are you doing anything that distinguishes left from right? By the way, what kind of grammar are you using? ... there are many kinds, Mar 29, 2014 at 5:23