-
Notifications
You must be signed in to change notification settings - Fork 0
NFA completion #91
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
NFA completion #91
Conversation
This adds two methods to NFA, - is_complete to check if the NFA is complete - complete to turn it into a complete NFA. The latter accepts an Option<State>, which is the sink to be used in new transitions. If None, self-loops will be added, otherwise new steps point ot the given (sing) state. New unit tests are included.
|
implementing this was challenging, because the alphaben needs to be computed lots as it is not explicitly represented in the NFA struct. questions that came up while touching this code:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds methods to verify and enforce completeness of NFAs, along with supporting helper and tests
- Implements
is_completeto check that every state has an outgoing transition for each symbol in the alphabet - Implements
completeto fill in missing transitions with either self-loops or a designated sink state - Adds
get_alphabethelper and new unit tests covering both methods
Comments suppressed due to low confidence (1)
src/nfa.rs:62
- Comparing
state_actions(Vec) withletters(Vec<&str>) will not compile due to a type mismatch. Consider converting one side to match the other (e.g., mapletterstoString).
if state_actions != letters {
Copilot found some typos in doc strings Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds functionality to check whether an NFA is complete over its alphabet and to complete it by filling in missing transitions, along with tests.
- Introduce
is_completeto verify that each state has transitions for every symbol. - Introduce
completeto add missing transitions, optionally targeting a sink state. - Add unit tests for completeness checking and completion behavior.
This adds two methods to NFA,
The latter accepts an Option, which is the sink to be used in new
transitions. If None, self-loops will be added, otherwise new steps
point ot the given (sing) state.
New unit tests are included.