7 #include <unordered_map>    43   typedef std::shared_ptr<expression const> 
exptr;
    69     literals(char32_t plus = U
'+', char32_t empty = U
'∅', char32_t epsilon = U
'ε',
    70         char32_t star = U
'*', char32_t rPar = U
')', char32_t lPar = U
'(')
    74       bool optimized = 
false, 
bool aggressive = 
false);
    76       bool optimized = 
false, 
bool aggressive = 
false);
    84   enum struct operation { empty, symbol, kleene, concatenation, alternation };
    93   std::vector<exptr>::const_iterator 
begin() 
const;
    94   std::vector<exptr>::const_iterator 
end() 
const;
    95   static std::unique_ptr<
    96       std::wstring_convert<std::codecvt_utf8<char32_t>,char32_t>
   110   static std::unordered_map<char32_t, exptr> symbols;
   111   std::vector<exptr> 
const subExpressions;
   113   std::unique_ptr<dfa const> 
mutable acceptingDfa;
 static std::unique_ptr< std::wstring_convert< std::codecvt_utf8< char32_t >, char32_t > > const converter
Converts between UTF-8-encoded and UTF-32-encoded strings. 
 
char32_t const S
The Kleene star. 
 
bool operator!=(expression const &r) const
Checks whether this RE is semantically different from another one. 
 
Token literals as used in Introduction to Automata Theory, Languages, and Computation by Hopcroft...
 
char32_t const EMPTY
Neutral element of alternation and annihilating element of concatenation, a.k.a. empty set...
 
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 ε. 
 
static exptr spawnFromString(std::u32string const &re, literals lits=literals(), bool optimized=false, bool aggressive=false)
Gives an RE encoded in a given string. 
 
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. 
 
std::u32string to_u32string() const
Describes this RE in UTF-32-encoded human-readable form. 
 
char32_t extractSymbol() const
Reports this symbol expression's UTF-32-encoded symbol. 
 
static exptr const  & spawnSymbol(char32_t symbol)
Gives an RE representing the given UTF-32-encoded symbol. 
 
operation
The different purposes an RE may fulfill. 
 
Parses regular expressions. 
 
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. 
 
std::string to_string() const
Describes this RE in UTF-32-encoded human-readable form. 
 
bool operator==(expression const &r) const
Checks whether this RE is semantically equivalent to another one. 
 
char32_t const L
The left parenthesis. 
 
char32_t const P
The alternation symbol. 
 
size_t size() const
Reports the size of this RE's tree representation. 
 
char32_t const EPSILON
Neutral element of concatenation, a.k.a. empty string. 
 
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 ∅. 
 
char32_t const R
The right parenthesis. 
 
std::string extractUtf8Symbol() const
Reports this symbol expression's UTF-8-encoded symbol. 
 
literals(char32_t plus=U'+', char32_t empty=U '∅', char32_t epsilon=U 'ε', char32_t star=U' *', char32_t rPar=U')', char32_t lPar=U'(')
 
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.