-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent duplicate states from being added to tables #22
Comments
Ah, thanks for taking a look. Speed is definitely an issue we need to work on. Perhaps we need a Java-esque Should I put up my Lua parser as a significantly nontrivial test case for you to play with? It may help catch obscure bugs/generate large tests; or it may just cause more headaches. |
Oh heck yes. I know @silentbicycle is also working on a Lua Earley parser, so at the least, he'd love that! |
I don't have a good gut feeling on whether an Also I just noticed that my grammar is now very post-midnight and I need to sleep, apparently! |
I just realized that the duplicate states are the different (ambiguous) derivations in my grammar. |
when COMPLETE adds the additional duplicate states to the current chart, it allows the closure to complete the full set of states in the chart. in order to remove the duplicate states, the closure calculation will have to change. i've seen other Earley parsers use a naive closure calc - 'process the full chart until it is not possible to add any more states' - that gets expensive. |
With the simple grammar from Aycock and Horspool:
When run against the trivial input:
This yields the following parse tables -- note the duplicate states.
It does parse correctly, however, yielding
So this is just an efficiency concern.
Right now this is due to the lack of duplication checking (or Set-like datastructure) in
State.prototype.process
, specificallytable[location].push(x);
I'm actively working on this but haven't figured out a tidy way to solve it yet.
The text was updated successfully, but these errors were encountered: