From nobody@digitalkingdom.org Sun Jun 22 15:15:54 2008 Received: with ECARTIS (v1.0.0; list lojban-list); Sun, 22 Jun 2008 15:15:55 -0700 (PDT) Received: from nobody by chain.digitalkingdom.org with local (Exim 4.69) (envelope-from ) id 1KAXqk-0008Rh-1K for lojban-list-real@lojban.org; Sun, 22 Jun 2008 15:15:54 -0700 Received: from wf-out-1314.google.com ([209.85.200.171]) by chain.digitalkingdom.org with esmtp (Exim 4.69) (envelope-from ) id 1KAXqd-0008RO-TH for lojban-list@lojban.org; Sun, 22 Jun 2008 15:15:53 -0700 Received: by wf-out-1314.google.com with SMTP id 23so1816261wfg.25 for ; Sun, 22 Jun 2008 15:15:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=SEkcFBkCIPjNcXXFRDar6HmQRZXVE7wtN/1ApxPduEo=; b=PZTsSlWR3GFyVHdX8rKJyqNSHXuESGoDT1s6bax6ae8842csgaMS2+t73LlXfotTpJ eeC8xhj8vlhNcpsNuzmWfk+MAWF7cLHLBw1CQpGl/xWHf4i9ccLwYByKuqbLIkKaWyZk +Kg3b2Lxc/yNr3gdhacdeOsWtDIKxBSBCqcbY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=Lc2+06YR7CVfdh+HfH600fVM4Fqed9hiEIQnxwtRinPPyeGCW3Vy/50LEZNg/8b/DC IlylfyKZy0q7eX1rrgCzPQM1E3tBUDKa7ZX6woq/4a95sPTwdlXkDCzJsEAH81skzeeB yMPvgtxvwgBYti9JRYu3L4yIbswSFyG8+7IwM= Received: by 10.142.158.3 with SMTP id g3mr3108375wfe.347.1214172946383; Sun, 22 Jun 2008 15:15:46 -0700 (PDT) Received: by 10.142.50.21 with HTTP; Sun, 22 Jun 2008 15:15:46 -0700 (PDT) Message-ID: <737b61f30806221515x6b48dde9w5fc9cd790011d3db@mail.gmail.com> Date: Sun, 22 Jun 2008 17:15:46 -0500 From: "Chris Capel" To: lojban-list@lojban.org Subject: [lojban] left recursion changes MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Spam-Score: -0.0 X-Spam-Score-Int: 0 X-Spam-Bar: / X-archive-position: 14538 X-ecartis-version: Ecartis v1.0.0 Sender: lojban-list-bounce@lojban.org Errors-to: lojban-list-bounce@lojban.org X-original-sender: pdf23ds@gmail.com Precedence: bulk Reply-to: lojban-list@lojban.org X-list: lojban-list 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. -statement-1 <- statement-2 (I-clause joik-jek statement-2?)* +statement-1 <- statement-1 I-clause joik-jek statement-2? / statement-2 -bridi-tail-1 <- bridi-tail-2 (gihek !(stag? BO-clause) !(stag? KE-clause) free* bridi-tail-2 tail-terms)* +bridi-tail-1 <- bridi-tail-1 gihek !(stag? BO-clause) !(stag? KE-clause) free* bridi-tail-2 tail-terms / bridi-tail-2 -terms-1 <- terms-2 (pehe-sa* PEhE-clause free* joik-jek terms-2)* +terms-1 <- terms-1 pehe-sa* PEhE-clause free* joik-jek terms-2 / terms-2 -sumti-2 <- sumti-3 (joik-ek sumti-3)* +sumti-2 <- sumti-2 joik-ek sumti-3 / sumti-3 -selbri-3 <- selbri-4+ +selbri-3 <- selbri-3 selbri-4 / selbri-4 -selbri-4 <- selbri-5 (joik-jek selbri-5 / joik stag? KE-clause free* selbri-3 KEhE-clause? free*)* +selbri-4 <- selbri-4 (joik-jek selbri-5 / joik stag? KE-clause free* selbri-3 KEhE-clause? free*) / selbri-5 tanru-unit-2 <- blah blah blah blah ... / - NU-clause NAI-clause? free* (joik-jek NU-clause NAI-clause? free*)* subsentence KEI-clause? free* + nu-clauses subsentence KEI-clause? free* + +nu-clauses <- nu-clauses joik-jek nu-nai / nu-nai + +nu-nai <- NU-clause NAI-clause? free* I'm planning on using this feature, xorxes. i mi ba nelci lo nu je ka jo du'u palci pilno .ui -tag <- tense-modal (joik-jek tense-modal)* +tag <- tag joik-jek tense-modal / tense-modal -stag <- simple-tense-modal ((jek / joik) simple-tense-modal)* / tense-modal (joik-jek tense-modal)* +stag <- stag (jek / joik) simple-tense-modal / simple-tense-modal / tag Now these two I'm not entirely sure about. But I don't think it hurts anything too much. On 'stag', besides the recursion I also changed the last option to just be a reference to 'tag', since the sequences were identical. I made these changes several days ago and haven't seen any problems yet, though that's not a sure indicator of anything. So I don't think there are any gross errors in here. Chris Capel -- "What is it like to be a bat? What is it like to bat a bee? What is it like to be a bee being batted? What is it like to be a batted bee?" -- The Mind's I (Hofstadter, Dennet) 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.