How's that for coincidence? I had just finally (on the 18th) got
around to watching Ian's "Trap a Better Mouse" talk and starting
to try it myself, and then saw that you posted this. I've done
some parsing before, so you haven't (yet) covered any of the parts
that I had trouble understanding. I *think* I've figured them out.
Now I have to finish implementing it and see if I'm right.

Mainly the recognizer. Did you figure that out? I think the
important insight is that matches added by scanning and completion
operations represent a (partial) derivation step. So your left
back-pointer gives the history of the rule that was advanced, and
your right back-pointer gives a rule which was applied just before
the cursor (but only if it points to a complete match).

So then you should just be able to do a depth-first traversal of
that tree?  Start with matches for the start symbol at the first
position in the final Earley state. For a left-most derivation,
follow the left back-pointer first.

If you want the prioritised-choice version, then you need to make
a choice each time you have multiple pairs of back-pointers. Look
at the right back-pointer of each and choose the one with the rule
earliest in the priority chain.

Yes? No?

I've been doing mine in Javascript and keeping an annotated
version as HTML -- sort of a literate program. So when I get it
finished, maybe I'll post that as well...we'll see how it turns
out.

--Josh
_______________________________________________
fonc mailing list
[email protected]
http://vpri.org/mailman/listinfo/fonc

Reply via email to