[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lojban] Re: left recursion changes
On Sun, Jun 22, 2008 at 05:15:46PM -0500, Chris Capel wrote:
> OK, I caved and implemented a subset of left recursion. It was
> surprisingly easy. The PEG now checks to see if the first item in
> the first sequence in the first option is a reference to itself.
> If so, that production will try to match the other, non-recursing
> options first, and if it finds a match, will try to match the
> first option using the match from the other option as the value of
> the recursive item. It repeats this until it can't eat any more
> text. The changes I made to the grammar to use this feature
> follow. They're quite regular--decrement the number in the first
> item, remove asterisk, and add an option for the next production.
This would be your own PEG parser generator, then? Sorry, I haven't
been following the thread.
You might want to look at whatever the Rats! guy did; his stuff also
automatically deals with left-recursion, but I think maybe in a
slightly more structured fashion? He's pretty approachable, you
might want to ask him.
-Robin
--
Lojban Reason #17: http://en.wikipedia.org/wiki/Buffalo_buffalo
Proud Supporter of the Singularity Institute - http://singinst.org/
http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/
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.