0
votes

Left recursion seems to be a big problem for many parser generators that are built upon the foundations of recursive descent parsing. I'm looking for a PEG-based parser generator that supports it - in whatever language.

2
PEGs don't support left recursion, as wikipedia says - "PEGs cannot express left-recursive rules where a rule refers to itself without moving forward in the string." There may be some that try to remove the left recursion, though. - user395760
Well I'm open to PEGs that transform or remove the left recursion without user intervention. - Frankie Ribery

2 Answers

2
votes

There is a paper on the topic available here: http://tratt.net/laurie/research/publications/papers/tratt__direct_left_recursive_parsing_expression_grammars.pdf

The author describes multiple approaches for handling left-recursive rules in PEG/Packrat parsing.

0
votes

My parser generator AustenX (scratchy.nz/austen.php) supports left recursion (including indirect), where option order matters (though I have never gotten around to writing up how this works). It is Packrat parser at heart, but memorisation can be dropped, and it makes no difference.