Vcsn comes with a set of programs that you use to manipulate automata, expressions, etc.
It is much less powerful than writing Python programs, however it comes handy occasionally to process a batch of files, or for a quick experiment.
vcsn COMMAND [OPTION...] ARG...
Run vcsn tafkit --help
for details on the interface:
!vcsn tafkit --help
To generate the standard automaton of [ab]*c
and save it in abc.gv
:
!vcsn standard -Ee '[ab]*c' -o abc.gv
import vcsn
vcsn.automaton(filename='abc.gv')
To generate a Thompson automaton, make it proper, minimize it and extract a rational expression from it:
!vcsn thompson -Ee '[ab]*c' | vcsn proper | vcsn determinize | vcsn to-expression
Likewise, but with an additional minimization step:
!vcsn thompson -Ee '[ab]*c' | vcsn proper | vcsn determinize | vcsn minimize | vcsn to-expression
The Python equivalent of these last runs are:
vcsn.B.expression('[ab]*c').thompson().proper().determinize().expression()
vcsn.B.expression('[ab]*c').thompson().proper().determinize().minimize().expression()