I'm solving (indirect Left Recursion) for these production rules .S is the starting symbol.S -> Aa / a   eq1A -> Sb / b.  eq2Now I can do this in two ways.First is :Putting A in eq1So I'll get the solution (sol1):S-> Sba /a /baand then S -> aS' / baS' S' -> baS' / epsilonThen another method is :Replacing S in eq2So I'll get the solution (sol2):S -> Aa / a A -> abA' / bA'A' -> abA' / epsilonNow which is the correct answer because both seems to be correct?.
Indirect Left recursion
formal grammars;parsers;left recursion