Received: from mail-ob0-f189.google.com ([209.85.214.189]:58402) by stodi.digitalkingdom.org with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) (envelope-from ) id 1Shjpi-00085P-UO; Thu, 21 Jun 2012 09:02:15 -0700 Received: by obbun3 with SMTP id un3sf851492obb.16 for ; Thu, 21 Jun 2012 09:02:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=x-beenthere:received-spf:mime-version:in-reply-to:references:date :message-id:subject:from:to:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-google-group-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe:content-type; bh=QKQG8mEan4Zi6gvjP+dR7DpiDobQibZhWwjfw4Pt6WA=; b=BL3u0aP5j8rgkR4yrpR8BDBuIvDAbFu5YY2imo+EjQ9ziCS8AD7/u4tYN5enOdKLL6 6Vnb2Rgsn/IpZAwhm8KVFC8WMKV44GZ0lkszaayGvvT6VJWnaLjriPGe7+NMVCsfe90Y UujQ9mc0EPMnVOyadsmFvUphNaQhvi66SStrw= Received: by 10.52.173.49 with SMTP id bh17mr523673vdc.2.1340294524512; Thu, 21 Jun 2012 09:02:04 -0700 (PDT) X-BeenThere: lojban@googlegroups.com Received: by 10.220.219.79 with SMTP id ht15ls294521vcb.3.gmail; Thu, 21 Jun 2012 09:02:04 -0700 (PDT) Received: by 10.52.29.193 with SMTP id m1mr19659230vdh.4.1340294524023; Thu, 21 Jun 2012 09:02:04 -0700 (PDT) Received: by 10.52.29.193 with SMTP id m1mr19659228vdh.4.1340294524007; Thu, 21 Jun 2012 09:02:04 -0700 (PDT) Received: from mail-vb0-f46.google.com (mail-vb0-f46.google.com [209.85.212.46]) by gmr-mx.google.com with ESMTPS id y20si8923686vdd.0.2012.06.21.09.02.03 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 21 Jun 2012 09:02:04 -0700 (PDT) Received-SPF: pass (google.com: domain of veijo.vilva@gmail.com designates 209.85.212.46 as permitted sender) client-ip=209.85.212.46; Received: by mail-vb0-f46.google.com with SMTP id ff1so387446vbb.19 for ; Thu, 21 Jun 2012 09:02:03 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.218.141 with SMTP id hq13mr13880216vcb.8.1340294523284; Thu, 21 Jun 2012 09:02:03 -0700 (PDT) Received: by 10.52.159.193 with HTTP; Thu, 21 Jun 2012 09:02:03 -0700 (PDT) In-Reply-To: References: Date: Thu, 21 Jun 2012 19:02:03 +0300 Message-ID: Subject: Re: [lojban] Testing Lua/LPeg version of the Lojban PEG From: Veijo Vilva To: lojban@googlegroups.com X-Original-Sender: veijo.vilva@gmail.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of veijo.vilva@gmail.com designates 209.85.212.46 as permitted sender) smtp.mail=veijo.vilva@gmail.com; dkim=pass header.i=@gmail.com Reply-To: lojban@googlegroups.com Precedence: list Mailing-list: list lojban@googlegroups.com; contact lojban+owners@googlegroups.com List-ID: X-Google-Group-Id: 1004133512417 List-Post: , List-Help: , List-Archive: Sender: lojban@googlegroups.com List-Subscribe: , List-Unsubscribe: , Content-Type: multipart/alternative; boundary=14dae9cfc830f46c7004c2fda26c X-Spam-Score: -0.7 (/) X-Spam_score: -0.7 X-Spam_score_int: -6 X-Spam_bar: / --14dae9cfc830f46c7004c2fda26c Content-Type: text/plain; charset=ISO-8859-1 On 21 June 2012 14:36, Remo Dentato wrote: > On Thu, Jun 21, 2012 at 10:08 AM, Veijo Vilva > wrote: > > I,ve now got a preliminary version of the full parser running. > > That's realy great! > > Will you offer an API? I would love to have the possibility of setting > call-backs for each element of the grammar. I did this for a (very > basic) morphology analyzer done with LPeg > (https://groups.google.com/d/topic/lojban/fSJWGpqr9eQ/discussion) and > I found it easy to use. > > Or will you build up the parse tree and return it as result of a > function? That would be fine as well. > There are two main PEG grammars, one for the morphology and one for the syntax, and a third one used by the morphology PEG to classify cmavo. The morphology PEG produces a Lua program segment containing one function call per word. This program segment can be used to drive custom formatting functions to produce input for an arbitrary back-end. The parser PEG produces a parse tree in the form of a Lua table definition which can be traversed by further processing steps like the pretty printer I used to produce the example listings. You can, of course, take the syntax LPeg and modify it to use call-backs, but I'm not sure it is worth your while as it is much easier to play with the parse tree. I'll be adding a few traversing functions like tree pruning (to replace the pruning during pretty printing) and sumti enumeration, which can be very useful for various purposes. I expect to be able to release an alpha version pretty soon. I'll just re-check the PEG, clean it a little bit and run through a random sample from the CLL. Veijo -- You received this message because you are subscribed to the Google Groups "lojban" group. To post to this group, send email to lojban@googlegroups.com. To unsubscribe from this group, send email to lojban+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/lojban?hl=en. --14dae9cfc830f46c7004c2fda26c Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable


On 21 June 2012 14:36, = Remo Dentato <rdentato@gmail.com> wrote:
On Thu, Jun 21, 2012 at 10:08 AM, Veijo Vilva <veijo.vilva@gmail.com> wrote:
> I,ve now got a preliminary version of the full parser running.

That's realy great!

Will you offer an API? I would love to have the possibility of setting
call-backs for each element of the grammar. I did this for a (very
basic) morphology analyzer done with LPeg
(https://groups.google.com/d/topic/lojban/fSJWGpqr9eQ/di= scussion) and
I found it easy to use.

Or will you build up the parse tree and return it as result of a
function? That would be fine as well.

<= br>
There are two main PEG grammars, one for the morphology and o= ne for the syntax, and a third one used by the morphology PEG to classify c= mavo.

The morphology PEG produces a Lua program segment conta= ining one function call per word. This program segment can be used to drive= custom formatting functions to produce input for an arbitrary back-end.

The parser PEG produces a parse tree in the form of a L= ua table definition which can be traversed by further processing steps like= the pretty printer I used to produce the example listings.

You can, of course, take the syntax LPeg and modify it to use ca= ll-backs, but I'm not sure it is worth your while as it is much easier = to play with the parse tree. I'll be adding a few traversing functions = like tree pruning (to replace the pruning during pretty printing) and sumti= enumeration, which can be very useful for various purposes.

I expect to be able to release an alpha version pretty = soon. I'll just re-check the PEG, clean it a little bit and run through= a random sample from the CLL.

=A0 Veijo


--
You received this message because you are subscribed to the Google Groups "= lojban" group.
To post to this group, send email to lojban@googlegroups.com.
To unsubscribe from this group, send email to lojban+unsubscribe@googlegrou= ps.com.
For more options, visit this group at http://groups.google.com/group/lojban= ?hl=3Den.
--14dae9cfc830f46c7004c2fda26c--