Indirect Left recursion I'm resolving indirect left recursion for these production rules:

S -&gt; Aa / a   eq1
A -&gt; Sb / b.  eq2


Where S is the starting symbol.

Now I can do this in two ways:


Putting A in eq1

So I'll get the solution (sol1):

S -&gt; Sba /a /ba


and then 

S -&gt; aS' / baS' 
S' -&gt; baS' / epsilon

Replacing S in eq2:

So I'll get the solution (sol2):

S -&gt; Aa / a 
A -&gt; abA' / bA'
A' -&gt; abA' / epsilon



Both seem to be correct. Which is the correct answer?
Yes, both your answers are correct. Note that the language under consideration is regular, see wikipedia.

The first grammar is equivalent to this regular expression:
$$r_1 = a(ba)^* \mid (ba)^+.$$

The second grammar is equivalent to this regular expression:
$$r_2 = (ab)^+a \mid b(ab)^*a \mid a.$$

It's easy to prove those regexes generate equal languages $L(r_1) = L(r_2)$.