开发者

Are there PEG-based parser generators that support left recursion?

开发者 https://www.devze.com 2023-03-01 20:45 出处:网络
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 generato开发者_StackOverflow社

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 generato开发者_StackOverflow社区r that supports it - in whatever language.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号