|
reglibcpp
1.7.0
(Naïve) C++ implementation of models for regular languages
|
Represents generalized nondeterministic finite automata. More...
#include <gnfa.h>
Classes | |
| struct | pImpl |
| Private implementation details of GNFAs. More... | |
Public Member Functions | |
| gnfa (dfa const &d) | |
| Constructs a GNFA with the same states and transitions as a given DFA. More... | |
| gnfa (nfa const &n) | |
| Constructs a GNFA with the same states and transitions as a given NFA. More... | |
| gnfa (expression::exptr r) | |
| Constructs a GNFA with only one transition. More... | |
| gnfa (gnfa const &n) | |
| Copy-constructs a GNFA by copying another one's private implementation object. More... | |
| gnfa (gnfa &&n) | |
| Move-constructs a GNFA by stealing another one's private implementation object. More... | |
| gnfa & | operator= (gnfa const &n) |
| Copy-assigns this GNFA by copying another one's private implementation object. More... | |
| gnfa & | operator= (gnfa &&n) |
| Move-assigns this GNFA by stealing another one's private implementation object. More... | |
| operator nfa const & () const | |
| Returns an NFA accepting the same language as this GNFA. More... | |
| bool | operator== (nfa const &n) const |
| Checks whether this RE describes the same regular language as another object. More... | |
| bool | operator!= (nfa const &n) const |
| Checks whether this RE describes a different regular language than another object. More... | |
| std::string const & | getInitialState () const |
| Reveals the name of this GNFA's initial state. More... | |
| std::string const & | getAcceptingState () const |
| Reveals the name of this GNFA's accept state. More... | |
| std::vector< std::reference_wrapper< std::string const > > | getActiveStates () const |
| Reveals the names of this GNFA's non-initial, non-accepting states. More... | |
| expression::exptr | getTransition (std::string const &qLabel, std::string const &pLabel) const |
| Extracts the RE labelling the transition between two states. More... | |
| std::vector< std::pair< std::reference_wrapper< std::string const >, std::reference_wrapper< std::string const > > > | getSplittableTransitions () const |
| Reveals this GNFA's splittable transitions. More... | |
| std::vector< std::reference_wrapper< std::string const > > | splitTransition (std::string const &qLabel, std::string const &pLabel) |
| Splits a transition between two states, adding new states if needed. More... | |
| nfa | splitAllTransitions () |
| Splits all transitions until only ∅, ε, and symbol REs remain and builds the resulting NFA. More... | |
| void | bypassTransition (std::string const &qLabel, std::string const &pLabel) |
| Removes a transition between two states and replaces it with equivalent ones, bypassing its beginning state. More... | |
| void | ripState (std::string const &qLabel) |
| Removes a state, bypassing all its outgoing transitions. More... | |
| expression::exptr | ripAllStates () |
| Removes all active states, constructing an RE semantically equivalent to this GNFA. More... | |
Represents generalized nondeterministic finite automata.
| reg::gnfa::gnfa | ( | dfa const & | d | ) |
Constructs a GNFA with the same states and transitions as a given DFA.
The following changes are applied upon conversion:
| d | the DFA to base the GNFA on |
Definition at line 120 of file gnfa.cpp.
| reg::gnfa::gnfa | ( | nfa const & | n | ) |
Constructs a GNFA with the same states and transitions as a given NFA.
The following changes are applied upon conversion:
| n | the NFA to base the GNFA on |
Definition at line 153 of file gnfa.cpp.
| reg::gnfa::gnfa | ( | expression::exptr | r | ) |
Constructs a GNFA with only one transition.
The GNFA will have only two states: the initial and the accept state and a transition with the given label leading from the former to the latter.
| r | the transition's RE |
| reg::gnfa::gnfa | ( | gnfa const & | n | ) |
Copy-constructs a GNFA by copying another one's private implementation object.
| reg::gnfa::gnfa | ( | gnfa && | n | ) |
Move-constructs a GNFA by stealing another one's private implementation object.
The other GNFA will be semantically equivalent to the ∅ RE afterwards.
| void reg::gnfa::bypassTransition | ( | std::string const & | qLabel, |
| std::string const & | pLabel | ||
| ) |
Removes a transition between two states and replaces it with equivalent ones, bypassing its beginning state.
Definition at line 345 of file gnfa.cpp.
| string const & reg::gnfa::getAcceptingState | ( | ) | const |
| vector< reference_wrapper< string const > > reg::gnfa::getActiveStates | ( | ) | const |
| string const & reg::gnfa::getInitialState | ( | ) | const |
| vector< pair< reference_wrapper< string const >, reference_wrapper< string const > > > reg::gnfa::getSplittableTransitions | ( | ) | const |
Reveals this GNFA's splittable transitions.
Definition at line 239 of file gnfa.cpp.
| expression::exptr reg::gnfa::getTransition | ( | std::string const & | qLabel, |
| std::string const & | pLabel | ||
| ) | const |
| reg::gnfa::operator nfa const & | ( | ) | const |
Returns an NFA accepting the same language as this GNFA.
| bool reg::gnfa::operator!= | ( | nfa const & | other | ) | const |
Checks whether this RE describes a different regular language than another object.
false if this RE's language is exactly the same as the other object's, true else Definition at line 428 of file gnfa.cpp.
Copy-assigns this GNFA by copying another one's private implementation object.
Move-assigns this GNFA by stealing another one's private implementation object.
The other GNFA will be semantically equivalent to the ∅ RE afterwards.
| bool reg::gnfa::operator== | ( | nfa const & | other | ) | const |
| expression::exptr reg::gnfa::ripAllStates | ( | ) |
Removes all active states, constructing an RE semantically equivalent to this GNFA.
exptr to the RE labelling the remaining transition between initial state and accept state Definition at line 393 of file gnfa.cpp.
| void reg::gnfa::ripState | ( | std::string const & | qLabel | ) |
Removes a state, bypassing all its outgoing transitions.
Definition at line 373 of file gnfa.cpp.
| nfa reg::gnfa::splitAllTransitions | ( | ) |
Splits all transitions until only ∅, ε, and symbol REs remain and builds the resulting NFA.
When building the NFA, transitions with symbol and ε REs are replaced with corresponding symbol transitions and transitions with ∅ REs will be ignored.
Definition at line 324 of file gnfa.cpp.
| vector< reference_wrapper< string const > > reg::gnfa::splitTransition | ( | std::string const & | qLabel, |
| std::string const & | pLabel | ||
| ) |
Splits a transition between two states, adding new states if needed.
The transition will be broken up into pieces, according to the semantics of its label.
| qLabel | the beginning state of the transition |
| pLabel | the end state of the transition |
Definition at line 261 of file gnfa.cpp.
1.8.14