Generate the Thompson automaton from an expression.
Preconditions:
Caveats:
Result.is_valid()
Properties:
Result.proper().is_isomorphic(r.standard())
See also:
The Thompson procedure generates an automaton with spontaneous-transitions, which requires a labelset that features a "one" label. The nullableset and wordset labelsets (and their compositions) do support a "one" label.
import vcsn
vcsn.context('lan_char, b').expression('a[bc]d').thompson()
vcsn.context('law_char, b').expression("'aa'[bc]'dd'").thompson()
You may, however, use a labelset which does not feature a "one", in which case the context of the automaton will be different from the one of the expression.
vcsn.context('lal_char, b').expression("a").thompson().context()
Weights are supported.
r = vcsn.context('lan_char(abc), q').expression('(<1/6>a*+<1/3>b*)*')
r
t = r.thompson()
t
t.proper()
r.standard()
Note however that you may generate invalid automata (from invalid expressions):
t = vcsn.context('lan_char(abc), q').expression('\e*').thompson()
t
t.is_valid()