This question already has an answer here:
Hello I have the above Context Free Grammar and I try to eliminate the left recursion so I can pass it to a tool. Any techniques I've read so far doesn't help me so a little help would be appreciated.
exp -> num | exp op exp | (exp) op -> + | - | * | /
I don't have the slightest idea on how to proceed. The only technique I've seen on the internet is to transform a CFG where the symbol appears once with another one and not twice or anything like below.
foo->foo a | b
which can be transformed:
foo-> a bar bar-> b bar | epsilon