A finite-state automaton for representing Whiley types. This is a machine for accepting matching inputs of a given language. An automaton is a directed graph whose nodes and edges are referred to as states and transitions. Each state has a "kind" which determines how the state behaves on given inputs. For example, a state with "OR" kind might accept an input if either of its children does; in contrast, and state of "AND" kind might accept an input only if all its children does.
The organisation of children is done according to two approaches: deterministic and non-deterministic. In the deterministic approach, the ordering of children is important; in the non-deterministic approach, the ordering of children is not important. A flag is used to indicate whether a state is deterministic or not.
Aside from having a particular kind, each state may also have supplementary material. This can be used, for example, to effectively provide labelled transitions. Another use of this might be to store a given string which must be matched.
NOTE: In the internal representation of automata, leaf states may be not be represented as actual nodes. This will occur if the leaf node does not include any supplementary data, and is primarily for space and performance optimisation. In such case, the node is represented as a child node using a negative index.
@author David J. Pearce