`algo`

`"auto"`

)¶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.

The * algo* can be:

`"auto"`

: same as`"regular"`

.`"compact"`

: use an alternate implementation for sum and product which requires fewer states.`"regular"`

: produce the "pure" version of the ZPC automaton.

Post-condition:

`Result.is_eps_acyclic()`

- There is no spontaneous path from the initial state to final the state.

Caveats:

- the context of the result might be different from the original context: spontaneous-transition support is required.

See also:

In [1]:

```
import vcsn
vcsn.B.expression('a[bc]d').zpc()
```

Out[1]:

You can also ask for the **compact** version of the algorithm that way:

In [2]:

```
vcsn.B.expression('a[bc]d').zpc('compact')
```

Out[2]:

In [3]:

```
vcsn.B.expression("a").zpc().context()
```

Out[3]:

Weights are supported.

In [4]:

```
r = vcsn.Q.expression('(<1/3>a*+<1/6>b*)*')
r
```

Out[4]:

In [5]:

```
r.zpc()
```

Out[5]:

And the compact version:

In [6]:

```
r.zpc('compact')
```

Out[6]: