From nobody@digitalkingdom.org Mon Jun 23 22:21:36 2008 Received: with ECARTIS (v1.0.0; list lojban-list); Mon, 23 Jun 2008 22:21:36 -0700 (PDT) Received: from nobody by chain.digitalkingdom.org with local (Exim 4.69) (envelope-from ) id 1KB0yF-0002So-VD for lojban-list-real@lojban.org; Mon, 23 Jun 2008 22:21:35 -0700 Received: from rlpowell by chain.digitalkingdom.org with local (Exim 4.69) (envelope-from ) id 1KB0yF-0002Sh-Rz for lojban-list@lojban.org; Mon, 23 Jun 2008 22:21:35 -0700 Date: Mon, 23 Jun 2008 22:21:35 -0700 From: Robin Lee Powell To: lojban-list@lojban.org Subject: [lojban] Re: left recursion changes Message-ID: <20080624052135.GZ318@digitalkingdom.org> Mail-Followup-To: lojban-list@lojban.org References: <737b61f30806221515x6b48dde9w5fc9cd790011d3db@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <737b61f30806221515x6b48dde9w5fc9cd790011d3db@mail.gmail.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-archive-position: 14545 X-ecartis-version: Ecartis v1.0.0 Sender: lojban-list-bounce@lojban.org Errors-to: lojban-list-bounce@lojban.org X-original-sender: rlpowell@digitalkingdom.org Precedence: bulk Reply-to: lojban-list@lojban.org X-list: lojban-list 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.