24 #include <unordered_map> 66 bool aggressive =
false);
68 bool optimized =
true,
69 bool aggressive =
false);
71 bool optimized =
true,
bool aggressive =
false);
73 bool aggressive =
false);
75 bool optimized =
false,
76 bool aggressive =
false);
84 enum struct operation { empty, symbol, kleene, concatenation, alternation };
88 operator nfa const&()
const;
Represents nondeterministic finite automata with ε-moves.
static char32_t N
The symbol used to represent the Null/empty set in a regular expression.
bool operator==(nfa const &other) const
Checks whether this RE describes the same regular language as another object.
std::vector< exptr >::const_iterator begin() const
Returns an iterator pointing to this RE's first subexpression.
static exptr const & spawnEmptyString()
Gives an RE representing the empty string ε.
bool operator!=(nfa const &other) const
Checks whether this RE describes a different regular language than another object.
static exptr const & spawnSymbol(std::string const &symbol)
Gives an RE representing the given UTF-32-encoded symbol.
std::string extractSymbol() const
Reports this symbol expression's UTF-8-encoded symbol.
static exptr spawnAlternation(exptr const &l, exptr const &r, bool optimized=true, bool aggressive=false)
Gives an RE representing the alternation of two given REs.
Represents formal regular expressions.
static exptr spawnFromString_(std::u32string const &u32re, bool optimized=false, bool aggressive=false)
Gives an RE encoded in a given UTF-32 string.
std::u32string to_u32string() const
Describes this RE in UTF-32-encoded human-readable form.
static exptr const & spawnSymbol_(char32_t u32symbol)
Gives an RE representing the given UTF-32-encoded symbol.
static exptr spawnFromString(std::string const &re, bool optimized=false, bool aggressive=false)
Gives an RE encoded in a given UTF-8 string.
operation
The different purposes an RE may fulfill.
operation getOperation() const
Reports this RE's function.
std::vector< exptr >::const_iterator end() const
Returns an iterator pointing behind this RE's last subexpression.
static char32_t K
The symbol used to represent the Kleene star in a regular expression.
std::string to_string() const
Describes this RE in UTF-8-encoded human-readable form.
size_t size() const
Reports the size of this RE's tree representation.
static char32_t L
The symbol used to represent the Left parenthesis in a regular expression.
Where this library lives.
static void reset()
Resets the symbols used for RE operators to their defaults.
static char32_t E
The symbol used to represent the Empty string in a regular expression.
char32_t extractSymbol_() const
Reports this symbol expression's UTF-32-encoded symbol.
std::shared_ptr< expression const > exptr
This is the type used to handle regular expressions.
static exptr const & spawnEmptySet()
Gives an RE representing the empty set ∅.
static char32_t R
The symbol used to represent the Right parenthesis in a regular expression.
static exptr spawnKleene(exptr const &b, bool optimized=true, bool aggressive=false)
Gives an RE representing the Kleene closure of a given RE.
static exptr spawnConcatenation(exptr const &l, exptr const &r, bool optimized=true, bool aggressive=false)
Gives an RE representing the concatenation of two given REs.
static char32_t A
The symbol used to represent the Alternation in a regular expression.