Hei Chris,
You have to think about what moves the parse forward, just as if you were
coding it by hand. The two relevant functions would look something like this
(in your grammar):
def parse_sum
parse_expr or return false
parse_wsp
parse('+') or return false
parse_wsp
parse_expr
end
def parse_expr
return true if parse_sum
return true if parse_add_call
parse_t_int
end
(Assuming that parse functions return a boolean indicating their success.) So
what you have there is direct mutual recursion between expr and sum. And put
like this (in code), it is easy to see, isn't it?
I guess your sum doesn't really allow any kind of expression in front, but
rather something that can be an element of a sum, like integers or function
calls. That avoids the recursion.
Here's something that works, maybe that helps you along as well:
https://gist.github.com/1339032
regards,
kaspar