[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lojban] Re: PEG left recursive definitions
- To: lojban-list@lojban.org
- Subject: [lojban] Re: PEG left recursive definitions
- From: "Jorge Llambías" <jjllambias@gmail.com>
- Date: Wed, 31 Oct 2007 10:30:40 -0300
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=TZXl3hdQVQKI4Ekf+rLOqF6LqnQtiV+3Lrot9EPnWH4=; b=pC0kFn7miHJpXAHYcyf9Dvk7CRxK/7Jce5I0ot9y2CUS4te2pyQiU57zYjPfCGY+agPow8AHVYwJv+dzJvlf04U3mf/BrjLFa/O2K/wsSzIeKAo3sOasJC0wcXOsp1nhl+01B0JvDrfdjb+g6KQf2+NFza8TtyI2Egewx15ulqw=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=E04GHsELx9E869F8cPMJJg+g66A7xReOLoTaqwqVKGmYpI+0j5u1/y9GKM+hpWAGB6ZM3iRiN38ZqCaGNy+SF0EapQ/UKf+CivZfhzg8AjL6k6n87oC0tXwI5WkGn/XOVs8NEtCbl9Hw/B4vp/HpQ/RrLAazHkSF02PvH8D33Ks=
- In-reply-to: <737b61f30710301744x530646c8q748ccb5190ec3eee@mail.gmail.com>
- References: <737b61f30710301744x530646c8q748ccb5190ec3eee@mail.gmail.com>
- Reply-to: lojban-list@lojban.org
- Sender: lojban-list-bounce@lojban.org
On 10/30/07, Chris Capel <pdf23ds@gmail.com> wrote:
> Does the PEG currently use left recursive definitions?
Left associativity is handled by rules such as:
selbri-3 <- selbri-4+
or:
sumti-2 <- sumti-3 (joik-ek sumti-3)*
so it is left implicit.
> If not, would it be helpful if it could?
It would be helpful if the parse tree is to show left associativity
explicitly.
> For instance. Example input:
>
> x ? x : x
>
> To parse this, we could write
>
> expr <- tri-cond / x
> tri-cond <- expr '?' expr ':' expr
> x <- 'x'
That's equivalent to:
expr <- expr '?' expr ':' expr / 'x'
which would not be allowed in PEG.
> This would be translated to
>
> expr-1 <- x
> tri-cond <- expr-1 '?' expr ':' expr / expr-1
> expr <- tri-cond / expr-1
> x <- 'x'
This one is equivalent to:
expr <- 'x' '?' expr ':' expr / 'x'
Which is allowed, but does not have an explicitly left associative parse tree.
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.