1 #ifndef VCSN_ALGOS_THOMPSON_HH
2 # define VCSN_ALGOS_THOMPSON_HH
21 template <
typename Aut,
24 :
public RatExpSet::const_visitor
34 using super_t =
typename ratexpset_t::const_visitor;
37 "thompson: requires nullable labels");
39 constexpr
static const char*
me() {
return "thompson"; }
57 return std::move(
res_);
87 res_->labelset()->conv(*
rs_.labelset(),
107 e.head()->accept(*
this);
111 for (
auto c: e.tail())
122 e.sub()->accept(*
this);
135 e.sub()->accept(*
this);
139 res_->set_weight(t,
ws_.mul(w,
res_->weight_of(t)));
144 e.sub()->accept(*
this);
148 res_->set_weight(t,
ws_.mul(
res_->weight_of(t), w));
167 template <
typename Aut,
171 const RatExpSet& rs,
const typename RatExpSet::value_t&
r)
181 template <
typename Aut,
184 thompson(
const RatExpSet& rs,
const typename RatExpSet::value_t&
r)
199 template <
typename RatExpSet>
205 using ratexpset_t = RatExpSet;
206 const auto& e = exp->as<ratexpset_t>();
209 using ctx_t = decltype(ctx);
223 #endif // !VCSN_ALGOS_THOMPSON_HH
weightset_t_of< ratexpset_t > weightset_t
An inner node with multiple children.
#define VCSN_RAT_UNSUPPORTED(Type)
REGISTER_DECLARE(accessible,(const automaton &) -> automaton)
std::shared_ptr< detail::automaton_base > automaton
typename ratexpset_t::const_visitor super_t
Aut thompson(const context_t_of< Aut > &ctx, const RatExpSet &rs, const typename RatExpSet::value_t &r)
Build a Thompson automaton from a ratexp.
typename detail::labelset_t_of_impl< base_t< ValueSet >>::type labelset_t_of
context_t_of< automaton_t > context_t
automaton make_automaton(const Aut &aut)
Build a dyn::automaton.
static constexpr const char * me()
std::shared_ptr< detail::mutable_automaton_impl< Context >> mutable_automaton
std::shared_ptr< detail::ratexp_base > ratexp
VCSN_RAT_VISIT(rweight, e)
nullableset_context_t< context< LabelSet, WeightSet > > make_nullableset_context(const context< LabelSet, WeightSet > &ctx)
The nullableset context of a context.
typename detail::context_t_of_impl< base_t< ValueSet >>::type context_t_of
thompson_visitor(const context_t &ctx, const ratexpset_t &rs)
Build an automaton of context ctx.
Build a Thompson automaton from a ratexp.
typename detail::label_t_of_impl< base_t< ValueSet >>::type label_t_of
typename detail::weightset_t_of_impl< base_t< ValueSet >>::type weightset_t_of
weight_t_of< ratexpset_t > weight_t
thompson_visitor(const ratexpset_t &rs)
Provide a variadic mul on top of a binary mul(), and one().
An inner node implementing a weight.
typename detail::weight_t_of_impl< base_t< ValueSet >>::type weight_t_of
automaton_t operator()(const typename ratexpset_t::value_t &v)
label_t_of< automaton_t > label_t
state_t_of< automaton_t > state_t
VCSN_RAT_VISIT(lweight, e)
typename detail::state_t_of_impl< base_t< ValueSet >>::type state_t_of
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 ratexp &exp)
Bridge.