Left recursion elimination
I have this grammar S->S+S|SS|(S)|S*|a I want to know how to eliminate the left recursion from this grammar because the S+S is really confusing... Let's see if we can simplify the given grammar. S -> S*|S+S|SS|(S)|a We can write it as; S -> S*|SQ|SS|B|a Q -> +S B -> (S) Now, you can eliminate left recursion in familiar territory. S -> BS'|aS' S' -> *S'|QS'|SS'|e Q -> +S B -> (S) Note that e is epsilon/lambda. We have removed the left recursion, so we no longer have need of Q and B. S -> (S)S'|aS' S' -> *S'|+SS'|SS'|e You'll find this useful when dealing with left recursion elimination . My