language-toolkit-1.0.1.0: A set of tools for analyzing languages via logic and automata
Copyright(c) 2019 Dakotah Lambert
Safe HaskellSafe-Inferred
LanguageHaskell2010

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

Synopsis

Documentation

embedSymbolsATT :: String -> Maybe String -> Maybe String -> String Source #

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) Source #

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 Source #

Convert an AT&T format string into one where input and output symbols have been reversed.

Importing

readATT :: String -> FSA Integer String Source #

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 Source #

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).