30 namespace VCSN_GRAPH_IMPL
32 VCSN_CONTEXT_NAMESPACE
38 template <
class InputIterator>
40 make_automata_set(InputIterator begin,
45 for (InputIterator e = begin; e != end; ++e)
49 monoid_t freemonoid(alpha);
50 series_set_t series(semiring, freemonoid);
52 return automata_set_t(series);
55 template <
class InputIterator>
57 make_automata_set(InputIterator begin,
59 const monoid_rep_t& mrep,
60 const series_rep_t& srep)
64 for (InputIterator e = begin; e != end; ++e)
68 monoid_t freemonoid(alpha, mrep);
69 series_set_t series(semiring, freemonoid, srep);
70 return automata_set_t(series);
73 template <
class InputIterator>
75 make_automaton(InputIterator begin,
78 return automaton_t(make_automata_set(begin, end));
81 template <
class InputIterator>
83 make_automaton(InputIterator begin,
85 const monoid_rep_t& mrep,
86 const series_rep_t& srep)
88 return automaton_t(make_automata_set(begin, end, mrep, srep));
93 make_automaton(
const T& alphabet)
95 return make_automaton(alphabet.begin(), alphabet.end());
100 make_automaton(
const T& alphabet,
101 const monoid_rep_t& mrep,
102 const series_rep_t& srep)
104 return make_automaton(alphabet.begin(), alphabet.end(), mrep, srep);
107 template <
class InputIterator>
109 make_automaton_letter(InputIterator begin,
112 return automaton_letter_t (make_automata_set(begin, end));
117 make_automaton_letter(
const T& alphabet)
119 return make_automaton_letter(alphabet.begin(), alphabet.end());
122 template <
class InputIterator>
124 make_gen_automaton(InputIterator begin,
127 return gen_automaton_t (make_automata_set(begin, end));
132 make_gen_automaton(
const T& alphabet)
134 return make_gen_automaton(alphabet.begin(), alphabet.end());
141 template <
class Iterator>
143 make_rat_exp(
const Iterator& begin,
145 const std::string& exp,
146 const monoid_rep_t& mrep,
147 const series_rep_t& srep)
150 for (Iterator i = begin; i != end; ++i)
152 monoid_t monoid (alphabet, mrep);
154 series_set_t series (semiring, monoid, srep);
156 rat_exp_t r (series);
157 std::pair<bool, std::string> p =
parse(exp, r);
159 postcondition_ (not p.first, p.second);
166 make_rat_exp(
const T& alphabet,
167 const std::string& exp,
168 const monoid_rep_t& mrep,
169 const series_rep_t& srep)
171 return make_rat_exp(alphabet.begin(), alphabet.end(),
179 template <
class SeriesImpl>
181 do_standard_of(
const series_set_t& structure,
const SeriesImpl& impl)
183 automaton_t r = make_automaton(structure.monoid().alphabet(),
184 *structure.monoid().representation(),
185 *structure.representation());
190 template <
class SeriesSet,
class SeriesImpl>
192 standard_of(
const Element<SeriesSet, SeriesImpl>& e)
194 return do_standard_of(e.structure(), e.value());
201 template <
class SeriesImpl>
203 do_thompson_of(
const series_set_t& structure,
const SeriesImpl& impl)
205 automaton_t r = make_automaton(structure.monoid().alphabet(),
206 *structure.monoid().representation(),
207 *structure.representation());
212 template <
class SeriesSet,
class SeriesImpl>
214 thompson_of(
const Element<SeriesSet, SeriesImpl>& e)
216 return do_thompson_of(e.structure(), e.value());
230 template <
class Chooser>
232 aut_to_exp(
const automaton_t& a,
const Chooser& c)