Generate the ZPC automaton from an expression. Its initial state is final and has the weight of its constant term. It can take an optionnal argument valued with "compact" to enable the compact variant construction.
algo can be:
"auto": same as
"compact": use an alternate implementation for sum and product which requires fewer states.
"regular": produce the "pure" version of the ZPC automaton.
The ZPC procedure generates an automaton with spontaneous-transitions, which requires a labelset that feature a "one" label. The nullableset and wordset labelsets (and their compositions) does support a "one" label.
import vcsn vcsn.B.expression('a[bc]d').zpc()
You can also ask for the compact version of the algorithm that way:
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.
Weights are supported.
r = vcsn.Q.expression('(<1/3>a*+<1/6>b*)*') r
And the compact version: