[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lojban] NORATS, SPACE, and PUBLIC in PEG grammar



On Tue, Nov 23, 2010 at 11:32:10AM -0700, .alyn.post. wrote:
> 
> 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.

Not having 40 years of history *does* matter sometimes.  :)

> 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.

That would be a nice way to do it, yeah.

> 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)?

I would be *shocked* if it didn't.  Lojban is, as far as anyone
knows, the largest and most complicated regular language grammar
that exists, except possibly the artificially-regular products of
natural language research.

Ah, here's one:

terms-1 <- terms-2 (pehe-sa* PEhE-clause free* joik-jek terms-2)*

> 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.

It's one level up.

Here: http://teddyb.org/~rlpowell/hobbies/lojban/grammar/grammar.tgz

That should simplify things for you.

-Robin

-- 
http://singinst.org/ :  Our last, best hope for a fantastic future.
Lojban (http://www.lojban.org/): The language in which "this parrot
is dead" is "ti poi spitaki cu morsi", but "this sentence is false"
is "na nei".   My personal page: http://www.digitalkingdom.org/rlp/

-- 
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.