30 template <
typename Value>
32 const std::string&
format =
"default")
34 std::ostringstream
os;
56 auto&& is = std::istringstream{data};
61 "unexpected trailing characters: ", is);
64 catch (
const std::runtime_error& e)
66 raise(e,
" while reading automaton");
75 std::istringstream is{s};
80 "unexpected trailing characters: ", is);
83 catch (
const std::runtime_error& e)
85 raise(e,
" while reading expression: ",
str_quote(s));
93 auto&& is = std::istringstream{s};
98 "unexpected trailing characters: ", is);
101 catch (
const std::runtime_error& e)
103 raise(e,
" while reading label: ",
str_quote(s));
110 auto&& is = std::istringstream{s};
115 "unexpected trailing characters: ", is);
118 catch (
const std::runtime_error& e)
120 raise(e,
" while reading polynomial: ",
str_quote(s));
127 auto&& is = std::istringstream{s};
132 "unexpected trailing characters: ", is);
135 catch (
const std::runtime_error& e)
137 raise(e,
" while reading weight: ",
str_quote(s));
143 const std::string&
format)
153 template <
typename Lhs,
typename Rhs>
155 -> decltype(l->vname(),
r->vname(), bool())
160 template <
typename Lhs,
typename Rhs>
162 -> decltype(l->vname(),
r->vname(), bool())
167 template <
typename Lhs,
typename Rhs>
174 template <
typename Lhs,
typename Rhs>
181 template <
typename Lhs,
typename Rhs>
188 template <
typename Lhs,
typename Rhs>
200 template <
typename Lhs,
typename Rhs>
202 -> decltype(
add(l,
r))
207 template <
typename Lhs,
typename Rhs>
214 template <
typename Lhs,
typename Rhs>
std::string configuration(const std::string &key)
Access a configuration value.
label read_label(const context &ctx, std::istream &is, const std::string &format="default")
Read a label from a stream.
polynomial make_polynomial(const context &ctx, const std::string &s)
Build a polynomial from a string.
weightset_mixin< detail::r_impl > r
bool are_equal(const automaton &lhs, const automaton &rhs)
Whether are the same automaton.
automaton make_automaton(const std::string &data, const std::string &format="default", bool strip=true)
Read an automaton from a string.
bool less_than(const automaton &lhs, const automaton &rhs)
Ordering between automata.
context make_word_context(const context &ctx)
The context for words.
auto operator<=(const Lhs &l, const Rhs &r) -> decltype(compare(l, r)<=0)
expression make_expression(const context &ctx, const std::string &s, identities ids={}, const std::string &format="default")
Read an expression from a stream.
auto operator>(const Lhs &l, const Rhs &r) -> decltype(compare(l, r) > 0)
expression read_expression(const context &ctx, identities ids, std::istream &is, const std::string &format="default", const location &loc=location{})
Read an expression from a stream.
automaton read_automaton(std::istream &is, const std::string &format="default", bool strip=true, const location &loc=location{})
Read an automaton from a stream.
weight read_weight(const context &ctx, std::istream &is)
Read a weight from a stream.
An expressionset can implement several different sets of identities on expressions.
An input/output format for valuesets.
Provide a variadic mul on top of a binary mul(), and one().
label make_label(const context &ctx, const std::string &s, const std::string &format="default")
Build a label from a string.
auto operator &(const Lhs &l, const Rhs &r) -> decltype(conjunction(l, r))
auto operator==(const Lhs &l, const Rhs &r) -> decltype(l->vname(), r->vname(), bool())
automaton conjunction(const automaton &lhs, const automaton &rhs, bool lazy=false)
The conjunction (aka synchronized product) of automata.
auto operator!=(const Lhs &l, const Rhs &r) -> decltype(l->vname(), r->vname(), bool())
std::ostringstream os
The output stream: the corresponding C++ snippet to compile.
Template-less root for contexts.
auto operator>=(const Lhs &l, const Rhs &r) -> decltype(compare(l, r) >=0)
std::string configuration(const std::string &key)
Get the string mapped by key (e.g., "configuration.version", "dot.styles").
auto operator*(const Lhs &l, const Rhs &r) -> decltype(multiply(l, r))
automaton strip(const automaton &a)
The automaton in a with its metadata layers removed.
weight make_weight(const context &ctx, const std::string &s)
Build a weight from a string.
automaton multiply(const automaton &lhs, const automaton &rhs, const std::string &algo="auto")
Multiply (concatenate) two automata.
label make_word(const context &ctx, const std::string &s, const std::string &format="default")
Build a word from a string.
std::string str_quote(Args &&... args)
Convert to a string, in quotes.
static identities ids(const driver &d)
Get the identities of the driver.
std::string format(const Value &v, const std::string &format="default")
std::ostream & print(const automaton &aut, std::ostream &out=std::cout, const std::string &format="default")
Print automaton a on out using format format.
void require(Bool b, Args &&... args)
If b is not verified, raise an error with args as message.
auto operator+(const Lhs &l, const Rhs &r) -> decltype(add(l, r))
auto operator<(const Lhs &l, const Rhs &r) -> decltype(compare(l, r)< 0)
int compare(const automaton &lhs, const automaton &rhs)
Three-way comparison between automata.
automaton add(const automaton &lhs, const automaton &rhs, const std::string &algo="auto")
Sum of two automata.
polynomial read_polynomial(const context &ctx, std::istream &is)
Read a polynomial from a stream.