| Copyright | (c) 2019-2023 Dakotah Lambert |
|---|---|
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
LTK.Porters.ATT
Description
This module provides methods to convert automata to and from the
AT&T FSM format. Generally there will be up to three text files,
the contents of which can be merged via embedSymbolsATT. When
exporting, you should similarly use extractSymbolsATT to unmerge
the resulting files.
Since: 0.3
Documentation
embedSymbolsATT :: String -> Maybe String -> Maybe String -> String #
Take three strings and merge them in such a way that (from ATT)
can understand the result.
The three strings should represent the transitions,
input symbols, and output symbols, respectively.
extractSymbolsATT :: String -> (String, String, String) #
Convert the output of (to ATT) into strings suitable for inclusion.
The result represents the transitions, input symbols, and output symbols
in that order.
invertATT :: String -> String #
Convert an AT&T format string into one where input and output symbols have been reversed.
Importing
readATT :: String -> FSA Integer String #
Import an FSA from its representation in AT&T format. Note that this import is not perfect; it discards weights and returns only the input projection.
Exporting
exportATT :: (Ord n, Ord e, Show e) => FSA n e -> String #
Convert an FSA into its AT&T format, with one caveat:
The LTK internal format allows for symbols that the AT&T format
does not understand, and no attempt is made to work around this.
Nonnumeric symbols are exported as-is,
while numeric symbols are necessarily mapped
to their tags in the symbols file(s).