|
Data.FsmActions.ActionMatrix |
|
|
|
|
Description |
Serialisation/deserialisation of FSMs and
Actions as binary adjacency matrices.
An Action may be represented as an adjacency matrix
of 0s and 1s. The rows and columns of the matrix correspond to states
of an FSM: a 1 in a cell indicates that the
Action causes a transition from the 'row' state to
the 'column' state. If any of the rows in the matrix contain more
than one 1, the corresponding Action and
FSM will be nondeterministic.
An ActionSpecFile is a list of (symbol string, path to ActionMatrix
file) pairs. Its syntax is as follows:
- Symbols, and paths, should all be enclosed in double quotes (with
the nice side-effect that spaces are thus allowed).
- A symbol/path pair is separated by whitespace.
- The list of symbol/path pairs is delimited by semicolons (and
optional whitespace). A trailing semicolon is optional.
- Line comments, starting with -- (as in Haskell), are allowed
anywhere whitespace is allowed.
|
|
Synopsis |
|
|
|
|
I/O
|
|
|
Load an FSM from action matrices, given a path
to an ActionSpec file.
|
|
|
Save an FSM to an ActionSpec file (whose path
is specified) and a set of action matrices (whose paths may be
optionally specified using a (label, path) association list).
|
|
Parsing
|
|
|
Given a (symbol, path) association list, compute an
FSM whose actions are read from action matrices
in the specified paths, and associated with their corresponding
symbols.
|
|
|
Given a (symbol, ActionMatrix string) association list, parse the
strings and construct an FSM. Includes normalisation and
well-formedness checks. Parse errors in individual action strings
result in an error here (ReadFsmMonad is in the Either monad).
Note that if the same symbol appears multiple times, only one
instance will appear in the FSM; the choice of which
appears is not defined.
|
|
|
Parse an action matrix string, and turn it into an
Action.
|
|
Pretty-printing
|
|
|
Pretty-print a string FSM into an ActionSpec string and an
(ActionMatrix path, ActionMatrix string) association list. (The
paths will be interpreted relative to the ActionSpec's location.)
Filenames (per action label) may be specified by providing a
(label, path) association list; whenever a lookup in that list
fails, a default is computed from the label.
|
|
|
Pretty-print an action in action matrix format.
|
|
Produced by Haddock version 2.6.0 |