-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
13 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Curious thought. | ||
|
||
Can we build an "index" from a grammar and a set of tokens? | ||
|
||
Idea enumerate all Earley items, and for each do the following: | ||
1. Initialize Earley Parser with first state set containing only the single Earley item. | ||
1. For each token (string), consume the string with the parser. | ||
- If the token is rejected (specifically, leading to an invalid state -- partial parses are OK), drop it and continue. | ||
1. Collect the generated state sets in an index. | ||
|
||
On later parses, we can just add (union of) the states we get by iterating over the Earley items in the last state set with the token being consumed. | ||
|
||
This index might be huge. Can we compress it? |