33 std::valarray<bool>
const&
delta(
size_t q, char32_t symbol)
const;
34 std::valarray<bool>
const&
delta(
size_t q, std::string
const& utf8Symbol)
const;
35 std::valarray<bool>
deltaHat(
size_t q, std::u32string
const& word)
const;
36 std::valarray<bool>
deltaHat(
size_t q, std::string
const& utf8Word)
const;
37 std::valarray<bool>
deltaHat(std::valarray<bool>
const& qs, std::u32string
const& word)
const;
38 std::valarray<bool>
deltaHat(std::valarray<bool>
const& qs, std::string
const& utf8Word)
const;
40 std::valarray<bool>
epsilonClosure(std::valarray<bool>
const& qs)
const;
42 std::string
getLabelOf(std::valarray<bool> qs)
const;
68 builder&
addTransition(std::string
const& from, std::string
const& to, std::string
const& utf8Symbol);
72 std::unique_ptr<pImpl> p;
76 std::unique_ptr<pImpl> p;
78 std::vector<char32_t>& alphabet,
79 std::vector<std::vector<std::valarray<bool>>>& transitions,
80 std::vector<std::string>& labels,
81 std::valarray<bool>& acceptingStates
nfa build()
Builds the NFA, as defined by previous operations.
Represents nondeterministic finite automata with ε-moves.
std::vector< char32_t > const & getAlphabet() const
Fetches this NFA's set of processable symbols.
std::string const & getLabelOf(size_t q) const
Puts a name to an index.
Represents deterministic finite automata.
std::vector< std::string > const & getUtf8Alphabet() const
Fetches this NFA's set of processable symbols as UTF-8-encoded strings.
std::valarray< bool > deltaHat(size_t q, std::u32string const &word) const
Computes this NFA's transition function recursively for a string of symbols, starting in a specified ...
Constructs NFAs step by step.
bool operator==(nfa const &n) const
Tests whether this NFA accepts exactly the same language as another one.
bool isAccepting(size_t q) const
Tests whether a state is an accept state within this NFA.
nfa & operator=(nfa const &n)
Copy-assigns this NFA by copying another one's private implementation object.
bool operator!=(nfa const &n) const
Tests whether this NFA doesn't accept the same language as another one.
builder & addSymbol(char32_t symbol)
Adds a symbol to the prospective NFA's alphabet.
builder & setAccepting(std::string const &state, bool accept)
Sets whether or not a state will be accepting within the prospective NFA.
Private implementation details of NFAs.
builder & makeInitial(std::string const &state)
Resets the initial state for the prospective NFA.
Private implementation details of NFA builders.
size_t getNumberOfStates() const
Counts this NFA's states.
nfa()
Constructs an NFA accepting the empty language ∅.
builder & operator=(builder const &b)
Copy-assigns a builder by copying another one's private implementation object.
builder & addTransition(std::string const &from, std::string const &to, char32_t symbol)
Adds a transition for the prospective NFA.
std::valarray< bool > const & delta(size_t q, char32_t symbol) const
Computes this NFA's transition function for a state and a symbol.
std::valarray< bool > const & epsilonClosure(size_t q) const
Computes a state's ε-closure.
builder()
Constructs a blank builder object.