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

Re: [lojban] confusion over FUhE-post PEG grammar rule



On Mon, Jan 31, 2011 at 07:14:03PM -0300, Jorge Llambías wrote:
> On Mon, Jan 31, 2011 at 12:05 PM, .alyn.post.
> <alyn.post@lodockikumazvati.org> wrote:
> > I'm confused over the intent of the FUhE-post production in the PEG
> > grammar:
> >
> > FUhE-clause <- FUhE-pre FUhE-post
> > FUhE-pre    <- pre-clause FUhE spaces?
> > FUhE-post   <- !BU-clause spaces? !ZEI-clause !BU-clause
> 
> Probably a remnant of an older version where it did something.
> 
> > The ! predicate does not advance the input, so if you walk through
> > each rule in the FUhE-post production, you try to:
> >
> >  * not match BU-clause.  If we find one, we no-match This  immediately
> >   and stop checking.  The input isn't advanced if we non-match it.
> 
> The idea is that "fu'e bu" will not match FUhE-clause.
> 
> I don't think this ever comes into play though. This applies to the
> !BU-clause !ZEI-clause in post-clause as well. If I'm not mistaken
> they ccould be removed.
> 

I think you're right, though I'm going to prove it with a test case
before removing them.  I'm getting there, but don't have anything
solid to report yet.

Properly testing this basically requires that I put most of the
parser together, so I've been focused on general infrastructure
building rather than on specific test cases.

> >  * the spaces? production will always match the empty string, as
> >   FUhE-post only appears in FUhE-clause, and FUhE-pre, the rule
> >   before it, ends with a spaces?
> 
> This also applies to the spaces? in post-clause. If I'm not mistaken,
> it never gets a chance to grab any spaces.
> 

Correct.  I have a patch out to camxes which fixes this, but I
haven't push it to Robin yet.

> >  * not match ZEI-clause.  If we find ZEI-clause, we immediately
> >   stop checking.  If we don't find one, the input is not advanced.
> >  * not match BU-clause.  This is where I get confused.  We haven't
> >   advanced the token stream, and we've already checked for a
> >   BU-clause earlier.
> 
> Right, it's redundant. But I think even the first one is doing nothing.
> 
> > The final !BU-clause is either:
> >
> >  * redundant
> >  * should be something like !(ZEI-clause BU-clause)
> 
> What for?
> 
> > Anything I missed?
> 
> Probably not. Remember that the PEG has never really been optimized,
> and it has gone through some changes, especially concerning magic
> words.
> 

After I fix the BU bug I recently identified, I'm going to test
magic word handling.  Once I have solid test cases there I'll be in
a position to both optimize the grammar and clean up cruft related
to changes that occured as Robin developed it into it's present
form.

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