reglibcpp
2.1.0
A C++ implementation of models for regular languages
|
Private implementation details of GNFAs. More...
Public Member Functions | |
impl () | |
Constructs private implementation object for a GNFA accepting the empty language ∅. More... | |
impl (unordered_map< string, unordered_map< string, expression::exptr >> &transitionMap, string const &initialState, forward_list< reference_wrapper< string const >> &acceptingStates, nfa const *eq) | |
Constructs private implementation object with provided members. More... | |
expression::exptr const & | getTransition (string const &qLabel, string const &pLabel) const |
Safely fetches a transition RE between two states. More... | |
void | addTransition (string const &qLabel, string const &pLabel, expression::exptr re, bool optimized=true, bool aggressive=false) |
Safely adds a transition RE between two states. More... | |
string const & | generateState (char prefix='q', char suffix='\0') |
Generates a unique new state name with given prefix (and suffix). More... | |
Public Attributes | |
std::shared_ptr< nfa const > | equivalent |
Points to a DFA accepting the same language as the owning GNFA. More... | |
unordered_map< string, unordered_map< string, expression::exptr > > | transitions |
Holds the transition table viz state × state → regular expression. More... | |
string | initial |
Holds the name of the initial state. More... | |
string | accepting |
Holds the name of the accept state. More... | |
|
inline |
|
inline |
|
inline |
Safely adds a transition RE between two states.
The resulting transition will be labelled with the alternation of the provided RE and the former RE labelling the transition.
qLabel | beginning of the transition |
pLabel | end of the transition |
re | the RE that should be added to the transition |
optimized | pass-through to expression::spawnAlternation |
aggressive | pass-through to expression::spawnAlternation |
|
inline |
Generates a unique new state name with given prefix (and suffix).
State name generation has two modes:
suffix == \0
: The name begins with prefix
and ends with an ever-increasing number.prefix
and ends with an ever-expanding repetition of suffix
. prefix | printable char the new state's name should begin with or \0 for empty prefix |
suffix | printable char the new state's name should end with or \0 for a number |
|
inline |
string reg::gnfa::impl::accepting |
|
mutable |
string reg::gnfa::impl::initial |
unordered_map<string, unordered_map<string, expression::exptr> > reg::gnfa::impl::transitions |