23 :
public ExpSet::const_visitor
34 using super_t =
typename expressionset_t::const_visitor;
37 "thompson: requires nullable labels");
40 constexpr
static const char*
me() {
return "thompson"; }
60 return std::move(
res_);
62 catch (
const std::runtime_error& e)
65 " while computing thompson automaton of: ",
79 void visit(const tuple_t&,
std::true_type)
override
81 raise(
me(),
": tuple is not supported");
104 res_->labelset()->conv(*
rs_.labelset(),
112 for (
const auto& c: e)
124 e.head()->accept(*
this);
128 for (
const auto& c: e.tail())
139 e.sub()->accept(*
this);
152 e.sub()->accept(*
this);
156 res_->set_weight(t,
ws_.mul(w,
res_->weight_of(t)));
161 e.sub()->accept(*
this);
165 res_->set_weight(t,
ws_.mul(
res_->weight_of(t), w));
183 template <Automaton Aut,
typename ExpSet>
186 const ExpSet&
rs,
const typename ExpSet::value_t&
r)
196 template <Automaton Aut,
typename ExpSet>
213 template <
typename ExpSet>
219 using expressionset_t = ExpSet;
220 const auto& e = exp->
as<expressionset_t>();
223 using ctx_t = decltype(ctx);
225 return ::vcsn::thompson<automaton_t>(
ctx, e.valueset(), e.value());
static dyn::context ctx(const driver &d)
Get the context of the driver.
thompson_visitor(const expressionset_t &rs)
SharedPtr make_shared_ptr(Args &&...args)
Same as std::make_shared, but parameterized by the shared_ptr type, not the (pointed to) element_type...
automaton thompson(const expression &exp)
Bridge.
VCSN_RAT_VISIT(rweight, e)
typename super_t::tuple_t tuple_t
An inner node implementing a weight.
std::shared_ptr< detail::mutable_automaton_impl< Context >> mutable_automaton
automaton_t operator()(const expression_t &v)
The Thompson automaton of v.
Aut thompson(const context_t_of< Aut > &ctx, const ExpSet &rs, const typename ExpSet::value_t &r)
Build a Thompson automaton from an expression.
Provide a variadic mul on top of a binary mul(), and one().
typename detail::label_t_of_impl< base_t< ValueSet >>::type label_t_of
Build a Thompson automaton from an expression.
typename detail::labelset_t_of_impl< base_t< ValueSet >>::type labelset_t_of
const expressionset_t & rs_
typename expressionset_t::const_visitor super_t
typename expressionset_t::value_t expression_t
auto out(const Aut &aut, state_t_of< Aut > s)
Indexes of visible transitions leaving state s.
auto in(const Aut &aut, state_t_of< Aut > s)
Indexes of visible transitions arriving to state s.
weight_t_of< expressionset_t > weight_t
#define VCSN_RAT_UNSUPPORTED(Type)
state_t_of< automaton_t > state_t
static constexpr const char * me()
Name of this algorithm, for error messages.
VCSN_RAT_VISIT(lweight, e)
typename detail::weight_t_of_impl< base_t< ValueSet >>::type weight_t_of
typename detail::state_t_of_impl< base_t< ValueSet >>::type state_t_of
void visit(const tuple_t &, std::true_type) override
An inner node with multiple children.
typename detail::weightset_t_of_impl< base_t< ValueSet >>::type weightset_t_of
nullableset_context_t< context< LabelSet, WeightSet > > make_nullableset_context(const context< LabelSet, WeightSet > &ctx)
The nullableset context of a context.
value_impl< detail::expression_tag > expression
weightset_t_of< expressionset_t > weightset_t
auto & as()
Extract wrapped typed automaton.
thompson_visitor(const context_t &ctx, const expressionset_t &rs)
Build an automaton of context ctx.
typename detail::context_t_of_impl< base_t< ValueSet >>::type context_t_of
context_t_of< automaton_t > context_t
std::string to_string(identities i)
Wrapper around operator<<.
label_t_of< automaton_t > label_t