Reimplementation of NFA to DFA, and Thompson NFA to Glushkov NFA conversions #193
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here I've rewritten these FSM conversions mostly for sake of performance, but also for simplicity. The approach here is focused on trying to do operations in bulk, rather than by doing a sequence of things for each item in turn. This itself gives about a 3x increase over the previous code, but more importantly it sets the scene for future optimisations, in particular for operating on sets of items in parallel.
The Glushkov construction in particular now operates in-situ, rather than by constructing a new FSM.
The diff here is super confusing; github shows this as a modification to the existing determinise.c. Of course that's nonsense, this is a rewrite from scratch (and in fact I did it in separate files before removing the previous implementations). If you're reading this, I suggest looking at determinise.c and glushkov.c just in isolation.
This builds on a lot of previous work; in particular for introducing numeric state indicies (so we can make assumptions about states created in one FSM being equivalent to states in another), and by undertaking epsilon closures in advance.