Action may be represented as an adjacency matrix
of 0s and 1s. The rows and columns of the matrix correspond to states
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
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.
- loadActionMxFsm :: FilePath -> IO (FSM String)
- saveActionMxFsm :: FSM String -> FilePath -> [(String, FilePath)] -> IO ()
- parseFsmActionMxFiles :: (Ord sy, Show sy) => [(sy, FilePath)] -> IO (FSM sy)
- parseFsmActionMxs :: (Ord sy, Show sy) => [(sy, String)] -> ReadFsmMonad (FSM sy)
- parseActionMx :: String -> ReadFsmMonad Action
- printFsmActionMx :: FSM String -> [(String, FilePath)] -> (String, [(FilePath, String)])
- printActionMx :: Action -> String
FSM from action matrices, given a path
to an ActionSpec file.
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).
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
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
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.