12 template <
typename Context>
13 mutable_automaton<Context>
16 const auto& ls = *ctx.labelset();
19 "ladybird: the alphabet needs at least 3 letters");
20 auto a = ls.value(letters[0]);
21 auto b = ls.value(letters[1]);
22 auto c = ls.value(letters[2]);
26 auto s =
res->new_state();
30 for (
unsigned i = 1; i < n; ++i)
32 auto y =
res->new_state();
33 res->new_transition(x, y, a);
34 res->new_transition(y, y,
b);
35 res->new_transition(y, y, c);
36 res->new_transition(y, s, c);
39 res->new_transition(x, s, a);
52 template <
typename Ctx,
typename Un
signed>
56 const auto& c = ctx->
as<Ctx>();
automaton ladybird(const dyn::context &ctx, unsigned n)
Bridge.
std::vector< typename Cont::value_type > make_vector(const Cont &cont)
The content of cont as a vector.
void require(Bool b, Args &&...args)
If b is not verified, raise an error with args as message.
auto & as()
Downcast to the exact type.
mutable_automaton< Context > ladybird(const Context &ctx, unsigned n)
Build the ladybird automaton of n states.
Template-less root for contexts.
Provide a variadic mul on top of a binary mul(), and one().
mutable_automaton< Context > make_mutable_automaton(const Context &ctx)