Skip to content
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

Earley Parser Improvements #21

Merged
merged 13 commits into from
Sep 3, 2018
Merged

Earley Parser Improvements #21

merged 13 commits into from
Sep 3, 2018

Conversation

srhickma
Copy link
Owner

@srhickma srhickma commented Sep 3, 2018

Re-Implemented the Earley parser to fix issues seen with epsilon productions in #11.
The resulting parser is different in three ways:

  • epsilon productions are predicted using the nullable symbols of a grammar, rather than using and extra completion loop.
  • the parse tree is produced by recursing through a modified earley item chart (parse_chart) using a depth-first search to find only the first parse tree. This algorithm replaces an algorithm which recursively built the entire parse forest using "back pointers" established during the recognition phase.
  • the warning for ambiguous parses was removed after it was discovered that grammar and scan producing two parse trees did not trigger the warning (false negative).

As a result of these modifications, the performance of the parser has drastically improved, and memory usage during parse-tree construction has been reduced (since we only build a single parse tree rather than the whole forest).

@srhickma srhickma merged commit 6370ccf into master Sep 3, 2018
@srhickma srhickma deleted the fix/epsilon_productions branch September 3, 2018 00:47
@srhickma srhickma mentioned this pull request Sep 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant