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.
Asked
Active
Viewed 636 times
0

Frankie Ribery
- 11,933
- 14
- 50
- 64
-
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. – Apr 28 '11 at 13:10
-
Well I'm open to PEGs that transform or remove the left recursion without user intervention. – Frankie Ribery Apr 28 '11 at 13:13
-
1possible duplicate of [Any PEG parser capable to handle left recursion?](http://stackoverflow.com/questions/4397039/any-peg-parser-capable-to-handle-left-recursion) – bummi Jan 03 '15 at 18:45
2 Answers
2
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.

jsherer
- 910
- 6
- 8
-
As far as I can see, only one approach and some ways to handle some problems around it are described – ruediste Jan 28 '15 at 20:29
0
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.

Matthew
- 1
- 1