language-toolkit-1.2.0.0: A set of tools for analyzing languages via logic and automata
Copyright(c) 2018-20202022-2023 Dakotah Lambert
LicenseMIT
Safe HaskellSafe-Inferred
LanguageHaskell2010

LTK.Porters

Description

This module provides methods to convert automata to and from various formats.

Synopsis

Conversions

In the following definitions, (Type t) is shorthand for (String -> t).

from :: Importable i => Type i -> String -> FSA Integer String Source #

Create an FSA from a String treated as the given Type.

fromE :: Importable i => Type i -> String -> Either String (FSA Integer String) Source #

Try to create an FSA from a String treated as the given Type.

to :: (Ord n, Ord e, Show n, Show e, Exportable x) => Type x -> FSA n e -> String Source #

Create a String from an FSA, formatted appropriately for the given Type.

Formats

We use types to create a bit of magic in order to read and write automata in various formats.

type Type t = t -> t Source #

An importable or exportable format.

newtype Dot Source #

The GraphViz Dot format.

Constructors

Dot Dot 

Instances

Instances details
Exportable Dot Source # 
Instance details

Defined in LTK.Porters

Methods

fromFSA :: (Ord n, Ord e, Show n, Show e) => (Dot -> Dot) -> FSA n e -> String Source #

newtype EggBox Source #

The egg-box in GraphViz Dot format.

Constructors

EggBox EggBox

Since: 1.1

Instances

Instances details
Exportable EggBox Source # 
Instance details

Defined in LTK.Porters

Methods

fromFSA :: (Ord n, Ord e, Show n, Show e) => (EggBox -> EggBox) -> FSA n e -> String Source #

newtype SyntacticOrder Source #

A Hasse diagram of the syntactic order.

Since: 1.1

Instances

Instances details
Exportable SyntacticOrder Source # 
Instance details

Defined in LTK.Porters

Methods

fromFSA :: (Ord n, Ord e, Show n, Show e) => (SyntacticOrder -> SyntacticOrder) -> FSA n e -> String Source #

newtype Jeff Source #

Jeff's format.

Constructors

Jeff Jeff 

Instances

Instances details
Exportable Jeff Source # 
Instance details

Defined in LTK.Porters

Methods

fromFSA :: (Ord n, Ord e, Show n, Show e) => (Jeff -> Jeff) -> FSA n e -> String Source #

Importable Jeff Source # 
Instance details

Defined in LTK.Porters

newtype Pleb Source #

The format defined by the (P)iecewise / (L)ocal (E)xpression (B)uilder.

Constructors

Pleb Pleb 

Instances

Instances details
Importable Pleb Source # 
Instance details

Defined in LTK.Porters

newtype ATT Source #

The AT&T finite-state transducer format, input projection

Since: 0.3

Constructors

ATT ATT 

Instances

Instances details
Exportable ATT Source # 
Instance details

Defined in LTK.Porters

Methods

fromFSA :: (Ord n, Ord e, Show n, Show e) => (ATT -> ATT) -> FSA n e -> String Source #

Importable ATT Source # 
Instance details

Defined in LTK.Porters

newtype ATTO Source #

The AT&T finite-state transducer format, output projection

Since: 0.3

Constructors

ATTO ATTO 

Instances

Instances details
Exportable ATTO Source # 
Instance details

Defined in LTK.Porters

Methods

fromFSA :: (Ord n, Ord e, Show n, Show e) => (ATTO -> ATTO) -> FSA n e -> String Source #

Importable ATTO Source # 
Instance details

Defined in LTK.Porters

newtype Corpus Source #

A corpus of strings

Since: 0.3

Constructors

Corpus Corpus 

Instances

Instances details
Importable Corpus Source # 
Instance details

Defined in LTK.Porters

Miscellaneous

formatSet :: Show n => Set n -> String Source #

Turn a Set into a String:

>>> formatSet (fromList [1, 2, 3])
"{1, 2, 3}"

transliterate :: Ord n => FSA n String -> FSA n String Source #

Automata in Jeff's format use edge labels of the form “w0.s1”. This function converts the edge labels of an automaton from this form to the “L`” form that we tend to use.

transliterateString :: String -> String Source #

See transliterate. This function operates directly on the representation of the edge label.

untransliterate :: Ord n => FSA n String -> FSA n String Source #

The inverse of transliterate.

class Importable t where Source #

A type that can be read and turned into an FSA.

Methods

toFSA :: (t -> t) -> String -> Either String (FSA Integer String) Source #

Instances

Instances details
Importable ATT Source # 
Instance details

Defined in LTK.Porters

Importable ATTO Source # 
Instance details

Defined in LTK.Porters

Importable Corpus Source # 
Instance details

Defined in LTK.Porters

Importable Jeff Source # 
Instance details

Defined in LTK.Porters

Importable Pleb Source # 
Instance details

Defined in LTK.Porters

class Exportable t where Source #

A type that can be written from an FSA.

Methods

fromFSA :: (Ord n, Ord e, Show n, Show e) => (t -> t) -> FSA n e -> String Source #

Instances

Instances details
Exportable ATT Source # 
Instance details

Defined in LTK.Porters

Methods

fromFSA :: (Ord n, Ord e, Show n, Show e) => (ATT -> ATT) -> FSA n e -> String Source #

Exportable ATTO Source # 
Instance details

Defined in LTK.Porters

Methods

fromFSA :: (Ord n, Ord e, Show n, Show e) => (ATTO -> ATTO) -> FSA n e -> String Source #

Exportable Dot Source # 
Instance details

Defined in LTK.Porters

Methods

fromFSA :: (Ord n, Ord e, Show n, Show e) => (Dot -> Dot) -> FSA n e -> String Source #

Exportable EggBox Source # 
Instance details

Defined in LTK.Porters

Methods

fromFSA :: (Ord n, Ord e, Show n, Show e) => (EggBox -> EggBox) -> FSA n e -> String Source #

Exportable Jeff Source # 
Instance details

Defined in LTK.Porters

Methods

fromFSA :: (Ord n, Ord e, Show n, Show e) => (Jeff -> Jeff) -> FSA n e -> String Source #

Exportable SyntacticOrder Source # 
Instance details

Defined in LTK.Porters

Methods

fromFSA :: (Ord n, Ord e, Show n, Show e) => (SyntacticOrder -> SyntacticOrder) -> FSA n e -> String Source #