expression.automaton(algo="auto")

Generate an automaton from an expression.

The algo can be:

See also:

Examples

In [1]:
import vcsn
e = vcsn.Z.expression('\e+<2>a+<3>b')
e
:0: FutureWarning: IPython widgets are experimental and may change in the future.
Out[1]:
$\varepsilon + \left\langle 2 \right\rangle \,a + \left\langle 3 \right\rangle \,b$
In [2]:
e.automaton('derived_term')
Out[2]:
%3 I0 0 0 I0->0 F0 F1 0->F0 1 1 0->1 ⟨2⟩a, ⟨3⟩b 1->F1
In [3]:
e.automaton('standard')
Out[3]:
%3 I0 0 0 I0->0 F0 F2 F3 0->F0 2 2 0->2 ⟨2⟩a 3 3 0->3 ⟨3⟩b 2->F2 3->F3
In [4]:
e.automaton('thompson')
Out[4]:
%3 I0 0 0 I0->0 F1 2 2 0->2 ε 4 4 0->4 ε 6 6 0->6 ε 1 1 1->F1 3 3 2->3 ε 3->1 ε 5 5 4->5 ⟨2⟩a 5->1 ε 7 7 6->7 ⟨3⟩b 7->1 ε
In [5]:
e.automaton('zpc')
Out[5]:
%3 I0 0 0 I0->0 F0 F7 0->F0 1 1 0->1 ε 3 3 0->3 ε 5 5 0->5 ε 2 2 7 7 2->7 ε 4 4 3->4 ⟨2⟩a 4->7 ε 6 6 5->6 ⟨3⟩b 6->7 ε 7->F7
In [6]:
e.automaton('zpc_compact')
Out[6]:
%3 I0 0 0 I0->0 F0 F5 0->F0 2 2 0->2 ε 1 1 3 3 1->3 ε 2->3 ⟨2⟩a 4 4 2->4 ε 5 5 3->5 ε 4->5 ⟨3⟩b 5->F5