From lojban+bncCLr6ktCfBBCwkbDnBBoEab2iHg@googlegroups.com Tue Nov 23 10:32:36 2010 Received: from mail-qy0-f189.google.com ([209.85.216.189]) by chain.digitalkingdom.org with esmtp (Exim 4.72) (envelope-from ) id 1PKxfI-0003gU-7w; Tue, 23 Nov 2010 10:32:35 -0800 Received: by qyk1 with SMTP id 1sf16152784qyk.16 for ; Tue, 23 Nov 2010 10:32:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:received:x-beenthere:received:received:received :received:received-spf:received:received:received:date:from:to :subject:message-id:mail-followup-to:references:mime-version :in-reply-to:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:sender:list-subscribe:list-unsubscribe:content-type :content-disposition; bh=3JvNvIM23tzL95B4Fp/Oan5fwBhRpfTxhQ4xInprwJ0=; b=AzxzrNh7LSPp8RRBm+u/6YbV2oG7p+P74GpNsPuKVaA9jjGF1FwML4nmy1B56umsJm VsGPEfvnYPzLw3awUKKhmDGjFxHsyeDub4lMFtmqbGP0+aAwevz6hNIzFvNJxPIypESF cS59LHH8ElquoyXO6wMqz0/yArC36cA1nkYKo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-beenthere:received-spf:date:from:to:subject:message-id :mail-followup-to:references:mime-version:in-reply-to :x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :sender:list-subscribe:list-unsubscribe:content-type :content-disposition; b=wXGBFMiAJS+W4nFuO7t4qwcq5OWN+nt52WjHnWZPOmQhgrSygmsxPZYl23iblypH0p 3e07n5Xgp0pu11Vg+PcIJljjcTIC3LvfvpYSTTAFf0IdYnLSqmVM6n+h8r11VM+BEjaZ Pj2idXHAheaCOoRiheFWlgYMpAqCbNWXrXa1Q= Received: by 10.229.34.72 with SMTP id k8mr822052qcd.2.1290537136902; Tue, 23 Nov 2010 10:32:16 -0800 (PST) X-BeenThere: lojban@googlegroups.com Received: by 10.229.69.77 with SMTP id y13ls2391093qci.3.p; Tue, 23 Nov 2010 10:32:16 -0800 (PST) Received: by 10.229.239.130 with SMTP id kw2mr844385qcb.4.1290537135625; Tue, 23 Nov 2010 10:32:15 -0800 (PST) Received: by 10.229.239.130 with SMTP id kw2mr844384qcb.4.1290537135582; Tue, 23 Nov 2010 10:32:15 -0800 (PST) Received: from mail-qw0-f41.google.com (mail-qw0-f41.google.com [209.85.216.41]) by gmr-mx.google.com with ESMTP id u1si1289385qco.9.2010.11.23.10.32.15; Tue, 23 Nov 2010 10:32:15 -0800 (PST) Received-SPF: neutral (google.com: 209.85.216.41 is neither permitted nor denied by best guess record for domain of alanpost@sunflowerriver.org) client-ip=209.85.216.41; Received: by qwj8 with SMTP id 8so280478qwj.14 for ; Tue, 23 Nov 2010 10:32:15 -0800 (PST) Received: by 10.224.19.147 with SMTP id a19mr4486975qab.286.1290537135136; Tue, 23 Nov 2010 10:32:15 -0800 (PST) Received: from sunflowerriver.org (c-68-35-167-179.hsd1.nm.comcast.net [68.35.167.179]) by mx.google.com with ESMTPS id x9sm3797561qco.10.2010.11.23.10.32.13 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 23 Nov 2010 10:32:14 -0800 (PST) Date: Tue, 23 Nov 2010 11:32:10 -0700 From: ".alyn.post." To: lojban@googlegroups.com Subject: Re: [lojban] NORATS, SPACE, and PUBLIC in PEG grammar Message-ID: <20101123183210.GD10838@alice.local> Mail-Followup-To: lojban@googlegroups.com References: <20101123180616.GB10838@alice.local> <20101123181027.GQ9301@digitalkingdom.org> <20101123181658.GR9301@digitalkingdom.org> Mime-Version: 1.0 In-Reply-To: <20101123181658.GR9301@digitalkingdom.org> X-Original-Sender: alyn.post@lodockikumazvati.org X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 209.85.216.41 is neither permitted nor denied by best guess record for domain of alanpost@sunflowerriver.org) smtp.mail=alanpost@sunflowerriver.org Reply-To: lojban@googlegroups.com Precedence: list Mailing-list: list lojban@googlegroups.com; contact lojban+owners@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: Sender: lojban@googlegroups.com List-Subscribe: , List-Unsubscribe: , Content-Type: text/plain; charset=ISO-8859-1 Content-Disposition: inline On Tue, Nov 23, 2010 at 10:16:58AM -0800, Robin Lee Powell wrote: > On Tue, Nov 23, 2010 at 10:10:27AM -0800, Robin Lee Powell wrote: > > On Tue, Nov 23, 2010 at 11:06:16AM -0700, .alyn.post. wrote: > > > What do the NORATS, SPACE, and PUBLIC statements mean in the > > > Lojban PEG grammar? > > > > > > They are prefixes to non-terminal statements which I haven't > > > encountered in other PEG files. > > > > They're used by > > http://www.digitalkingdom.org/~rlpowell/hobbies/lojban/grammar/rats/peg2rats.pl > > to create the actual Rats! grammar. It's all a horrible hack, and > > someone should really write something better now that there are > > other decent PEG parser generators around. > > To be clear there: the point was that someone making their own > parser could just strip those tags out. I didn't want there to be > any Rats!-specific stuff in the grammar if I could avoid it. > I saw the SPACE symbol and thought somehow there was non-standard handling of optional whitespace around terminals, and became concerned that the grammar itself was non-standard. I had a brief conversation on the PEG parser mailing list about associating code with rules in a PEG grammar. It seems that embedding code inside '{}' brackets has become the standard way of putting code inside a peg file, but there is no concensus on whether that code should execute every time a production is parsed (even after a backtrack), only executed the first time but not if the rule was rematched after memoization, or only at the end of a successful parse. Some parsers give you a flag or hook to say when code is executed. The most compelling case I found was where the 'code' inside '{}' brackets was actually more like a tag, and the source code file that handled the parse tree was stored separately from the grammar. So tags inside '{}' were effectively function calls, but could in theory be language independent. There also doesn't seem to be a concensus on how to associate elements in the production with the code, with some tools giving you access to the parse tree itself (and hence requiring an API to access parser productions) while others bracket or tag elements that will be passed to a '{}' function and extend the grammar to accept brackets and tags. Do you know off-hand if the lojban grammar has something like this: expr <- mulexpr [+] mulexpr mulexpr <- digits [*] digits digits <- [0-9]+ Where a particular rule (in this case expr and mulexpr) has the same non-terminal more than once (mulexpr non-terminal for rule expr and digits non-terminal for rule mulexpr)? Also, what does snarf_morph.sh, from the cook file, do? I would assume it grabs xorxes' morphology file from lojban.org? I didn't see snarf_morph.sh in the rats/ folder. -Alan -- .i ko djuno fi le do sevzi -- 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.