Eliminating left recursion for E -> E E + | num
The grammar:
E -> E E +
E -> num
I tried to use the formula for left recursion elimination and got:
E -> num E'
E' -> E Op E' | ɛ
I think I am missing something but this doesn't seem equivalent to me.
In the first grammar, it seems to me that every word in the language doesn't start with more than 2 num
s, but in the second grammar this seems entirely possible.
from Recent Questions - Stack Overflow https://ift.tt/3pyB82R
https://ift.tt/eA8V8J
Comments
Post a Comment