cppformlang::finite_automata::NondeterministicFiniteAutomaton class

Represents a general finite automaton.

Base classes

template<typename Transitions>
class FiniteAutomaton<NondeterministicTransitions>
Represents a general finite automaton.

Public static functions

static auto FromRegex(const std::string& regex) -> NondeterministicFiniteAutomaton

Constructors, destructors, conversion operators

NondeterministicFiniteAutomaton()
NondeterministicFiniteAutomaton(char c) explicit

Public functions

void Union(const FiniteAutomaton& other)
Makes the union of this and other object.
void Concatenate(const FiniteAutomaton& other)
Makes the concatenation of this and other object.
void KleeneStar()
Makes the kleene star of the current object.
auto Accepts(const Symbol* begin, const Symbol* end) const -> bool
Checks whether the nfa accepts a given word.
auto Eclose(State state) const -> std::unordered_set<State>
Compute the epsilon closure of of state.
auto IsDeterministic() const -> bool
auto ToDeterministic() const -> NondeterministicFiniteAutomaton
auto Minimize() const -> NondeterministicFiniteAutomaton

Function documentation

bool cppformlang::finite_automata::NondeterministicFiniteAutomaton::Accepts(const Symbol* begin, const Symbol* end) const

Checks whether the nfa accepts a given word.

Parameters
begin in Begin of the word(source symbols)
end in End of the word(source symbols)
Returns Whether the word is accepted or not

std::unordered_set<State> cppformlang::finite_automata::NondeterministicFiniteAutomaton::Eclose(State state) const

Compute the epsilon closure of of state.

Parameters
state in The source state
Returns The epsilon closure of the source state