expression
.info(key=None)
¶A dictionary of facts about an expression.
The keys of the dictionary are:
length
, size
: the number of nodes in the syntax treewidth
, atom
: the number of letter occurrencesdepth
: the depth of the syntax tree (the depth of $a$ is 0, not 1)type
: the implementation typeadd
, complement
, etc.: the number of occurrences of these operators (+
, {c}
, etc.) in the expressionArguments:
key
: if specified, return just the corresponding result.See also:
import vcsn
e = vcsn.Q.expression('[ab]*a[ab]')
e
e.SVG()
e.info()
e.info('type')
Note that, although the expression uses a variadic product (the .
node features three children), the length corresponds to the usual definition of expressions based on binary node. Hence the tree features 9 nodes, but the length of the expression is 10. This applies to all the variadic operators.
e.info('length')
e.info('depth')
e = vcsn.Q.expression('[ab]*a[ab]{2} & [ab]*a[ab]{4}')
e
e.SVG()
e.info()
vcsn.Q.expression('[ab]a[ab]').info()