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 #

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

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

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 #

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 #

An importable or exportable format.

newtype Dot #

The GraphViz Dot format.

Constructors

Dot Dot 

Instances

Instances details
Exportable Dot # 
Instance details

Defined in LTK.Porters

Methods

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

newtype EggBox #

The egg-box in GraphViz Dot format.

Constructors

EggBox EggBox

Since: 1.1

Instances

Instances details
Exportable EggBox # 
Instance details

Defined in LTK.Porters

Methods

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

newtype SyntacticOrder #

A Hasse diagram of the syntactic order.

Since: 1.1

Instances

Instances details
Exportable SyntacticOrder # 
Instance details

Defined in LTK.Porters

Methods

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

newtype Jeff #

Jeff's format.

Constructors

Jeff Jeff 

Instances

Instances details
Exportable Jeff # 
Instance details

Defined in LTK.Porters

Methods

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

Importable Jeff # 
Instance details

Defined in LTK.Porters

Methods

toFSA :: (Jeff -> Jeff) -> String -> Either String (FSA Integer String) #

newtype Pleb #

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

Constructors

Pleb Pleb 

Instances

Instances details
Importable Pleb # 
Instance details

Defined in LTK.Porters

Methods

toFSA :: (Pleb -> Pleb) -> String -> Either String (FSA Integer String) #

newtype ATT #

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

Since: 0.3

Constructors

ATT ATT 

Instances

Instances details
Exportable ATT # 
Instance details

Defined in LTK.Porters

Methods

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

Importable ATT # 
Instance details

Defined in LTK.Porters

Methods

toFSA :: (ATT -> ATT) -> String -> Either String (FSA Integer String) #

newtype ATTO #

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

Since: 0.3

Constructors

ATTO ATTO 

Instances

Instances details
Exportable ATTO # 
Instance details

Defined in LTK.Porters

Methods

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

Importable ATTO # 
Instance details

Defined in LTK.Porters

Methods

toFSA :: (ATTO -> ATTO) -> String -> Either String (FSA Integer String) #

newtype Corpus #

A corpus of strings

Since: 0.3

Constructors

Corpus Corpus 

Instances

Instances details
Importable Corpus # 
Instance details

Defined in LTK.Porters

Miscellaneous

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

Turn a Set into a String:

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

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

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 #

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

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

The inverse of transliterate.

class Importable t where #

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

Methods

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

Instances

Instances details
Importable ATT # 
Instance details

Defined in LTK.Porters

Methods

toFSA :: (ATT -> ATT) -> String -> Either String (FSA Integer String) #

Importable ATTO # 
Instance details

Defined in LTK.Porters

Methods

toFSA :: (ATTO -> ATTO) -> String -> Either String (FSA Integer String) #

Importable Corpus # 
Instance details

Defined in LTK.Porters

Importable Jeff # 
Instance details

Defined in LTK.Porters

Methods

toFSA :: (Jeff -> Jeff) -> String -> Either String (FSA Integer String) #

Importable Pleb # 
Instance details

Defined in LTK.Porters

Methods

toFSA :: (Pleb -> Pleb) -> String -> Either String (FSA Integer String) #

class Exportable t where #

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 #

Instances

Instances details
Exportable ATT # 
Instance details

Defined in LTK.Porters

Methods

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

Exportable ATTO # 
Instance details

Defined in LTK.Porters

Methods

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

Exportable Dot # 
Instance details

Defined in LTK.Porters

Methods

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

Exportable EggBox # 
Instance details

Defined in LTK.Porters

Methods

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

Exportable Jeff # 
Instance details

Defined in LTK.Porters

Methods

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

Exportable SyntacticOrder # 
Instance details

Defined in LTK.Porters

Methods

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