You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After adding some tracing, the problem is the heuristic in gg-recall that doesn't activate rules which aren't involved in the recursion. In the first grammar above, rule a is not involved in the recursion (only a is) and so gg-recall eagerly memoizes failure for it.
Activity
dominiccooney commentedon Nov 13, 2009
Interestingly this equivalent grammar succeeds:
dominiccooney commentedon Nov 14, 2009
I think this is a bug in the left-recursive PEG algorithm; pinged gurus at https://lists.csail.mit.edu/pipermail/peg/2009-November/000244.html
dominiccooney commentedon Sep 24, 2010
I think the best thing to do is to disallow nullable left-recursive rules, probably by warning about them and failing if they're activated.
dominiccooney commentedon Oct 15, 2010
After adding some tracing, the problem is the heuristic in gg-recall that doesn't activate rules which aren't involved in the recursion. In the first grammar above, rule a is not involved in the recursion (only a is) and so gg-recall eagerly memoizes failure for it.
If that heuristic is relaxed, the parser succeeds and computes the right result. However this has bad downstream effects when a is right-recursive. Laurence Tratt has drafted a paper about this at https://lists.csail.mit.edu/pipermail/peg/2009-November/000248.html