[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lojban] Re: PEG left recursive definitions
Here is a discussion on left-recursion in peg parsers:
http://www.mail-archive.com/peg@lists.csail.mit.edu/msg00086.html
John
On Wed, 2007-10-31 at 13:26 -0300, Jorge Llambías wrote:
> On 10/31/07, Chris Capel <pdf23ds@gmail.com> wrote:
> >
> > Do you not think that the grammar definition itself would be better
> > expressed with explicit left-recursion?
>
> Yes, I do, for the cases of left associativity. So for example the
> left recursive:
>
> sumti-2 <- (sumti-2 joik-ek)? sumti-3
>
> would reflect the left associativity better than the current:
>
> sumti-2 <- sumti-3 (joik-ek sumti-3)*
>
>
> > > expr <- expr '?' expr ':' expr / 'x'
> > > which would not be allowed in PEG.
> >
> > Well, "not allowed" in most implementations of PEG. (Although direct
> > left recursion *is* rewritten automatically in Pappy.) But since it's
> > isomorphic (i.e. identical after rewriting) to a non-left-recursive
> > definition, I don't see why you'd say it's not allowed at all.
>
> I probably used the wrong words. I don't know much more about
> this than what I learned from the Lojban PEG. I meant it would not be
> allowed in Robin's implementation.
>
> mu'o mi'e xorxes
>
>
> To unsubscribe from this list, send mail to lojban-list-request@lojban.org
> with the subject unsubscribe, or go to http://www.lojban.org/lsg2/, or if
> you're really stuck, send mail to secretary@lojban.org for help.
>
To unsubscribe from this list, send mail to lojban-list-request@lojban.org
with the subject unsubscribe, or go to http://www.lojban.org/lsg2/, or if
you're really stuck, send mail to secretary@lojban.org for help.