14 template <
typename Context>
15 mutable_automaton<Context>
18 const auto& ls = *ctx.labelset();
21 "ladybird: the alphabet needs at least 3 letters");
22 auto a = ls.value(letters[0]);
23 auto b = ls.value(letters[1]);
24 auto c = ls.value(letters[2]);
28 auto s = res->new_state();
32 for (
unsigned i = 1; i < n; ++i)
34 auto y = res->new_state();
35 res->new_transition(x, y, a);
36 res->new_transition(y, y,
b);
37 res->new_transition(y, y, c);
38 res->new_transition(y, s, c);
41 res->new_transition(x, s, a);
54 template <
typename Ctx,
typename Un
signed>
58 const auto& c = ctx->as<Ctx>();
automaton ladybird(const dyn::context &ctx, unsigned n)
Bridge.
automaton make_automaton(const Aut &aut)
Build a dyn::automaton.
void require(Bool b, Args &&...args)
If b is not verified, raise an error with args as message.
mutable_automaton< Context > ladybird(const Context &ctx, unsigned n)
Provide a variadic mul on top of a binary mul(), and one().
std::shared_ptr< const detail::context_base > context
A dyn::context.
std::vector< typename Cont::value_type > make_vector(const Cont &cont)
The content of cont as a vector.
std::shared_ptr< detail::automaton_base > automaton
static dyn::context ctx(const driver &d)
Get the context of the driver.
mutable_automaton< Context > make_mutable_automaton(const Context &ctx)