That's the whole point of this, trying to add left recursion support to PEG. This is a topic which has already been discussed a few times and in a few papers.
Basically there are two reasons why you don't want to rewrite your rules: 1. In case an AST is automagically generated, have it left-associative 2. Reduce the effort of implementing existing grammars, specified using left-recursion >From my experience, I think that both reasons do not compensate the complexity added by the support of left-recursion. Hence, I personnally do not want left-recursion in PEG. 2012/2/1 Francisco Mota <fmot...@gmail.com> > A PEG parser should never match anything with this rule, because to > match the symbol a you must first attempt to match the symbol a. (If > your parser matches anything with this rule, it isn't a PEG parser.) > > Why don't you rewrite your rule as follows? > > a <- ('a' / 'b')* 'a' / 'b' > > Best, > - Francisco Mota > > On 1/31/12, Ondřej Bílka <nel...@seznam.cz> wrote: > > What your parser does on following rule: > > a = a* 'a' | 'b' > > say on string ababbba > > > > -- > > > > NOTICE: alloc: /dev/null: filesystem full > > > > _______________________________________________ > > PEG mailing list > > PEG@lists.csail.mit.edu > > https://lists.csail.mit.edu/mailman/listinfo/peg > > > > _______________________________________________ > PEG mailing list > PEG@lists.csail.mit.edu > https://lists.csail.mit.edu/mailman/listinfo/peg >
_______________________________________________ PEG mailing list PEG@lists.csail.mit.edu https://lists.csail.mit.edu/mailman/listinfo/peg