UMinho Haskell Libraries (1.0)ContentsIndex
Language.HaLex.Ndfa
Portability portable
Stability provisional
Maintainer jas@di.uminho.pt
Contents
Data type
Description
Non-Deterministic Finite Automata in Haskell. Code Included in the Lecture Notes on Language Processing (with a functional flavour).
Synopsis
data Ndfa st sy = Ndfa [sy] [st] [st] [st] (st -> Maybe sy -> [st])
toHaskell :: Show fa => fa -> [Char] -> IO ()
renameNdfa :: Eq st => Ndfa st sy -> Int -> Ndfa Int sy
transitionTableNdfa :: Ndfa st sy -> [(st, Maybe sy, st)]
ndfaaccept :: Ord st => Ndfa st sy -> [sy] -> Bool
ndfawalk :: Ord st => (st -> Maybe sy -> [st]) -> [st] -> [sy] -> [st]
epsilon_closure :: Ord st => (st -> Maybe sy -> [st]) -> [st] -> [st]
sizeNdfa :: Ndfa st sy -> Int
limit :: Eq a => (a -> a) -> a -> a
ndfaIsStDead :: Ord st => st -> [sy] -> [st] -> (st -> Maybe sy -> [st]) -> Bool
Data type
data Ndfa st sy
The type of Non-Deterministic Finite Automata. Paramterized with the type st of states and sy of symbols.
Constructors
Ndfa [sy] [st] [st] [st] (st -> Maybe sy -> [st])
Instances
(Show st, Show sy, Ord st, Ord sy) => Fa Ndfa st sy
(Eq st, Show st, Show sy) => Show (Ndfa st sy)
toHaskell
:: Show fa
=> faAutomaton
-> [Char]Haskell module or file name
-> IO ()
Produce the transition table of a given finite automaton.
renameNdfa :: Eq st => Ndfa st sy -> Int -> Ndfa Int sy
Renames a Ndfa.
transitionTableNdfa
:: Ndfa st syAutomaton
-> [(st, Maybe sy, st)]Transition table

Produce the transition table of a given Ndfa.

Given a Ndfa it returns a list of triples of the form (Origin,Symbol,Destination) defining all the transitions of the Ndfa.

ndfaaccept
:: Ord st
=> Ndfa st syAutomaton
-> [sy]Input symbols
-> Bool
Test whether the given automaton accepts the given list of input symbols.
ndfawalk
:: Ord st
=> (st -> Maybe sy -> [st])Transition function
-> [st]Initial states
-> [sy]Input symbols
-> [st]Reached states
Execute the transition function of a Ndfa on an initial state and list of input symbol. Return the final state when all input symbols have been consumed.
epsilon_closure
:: Ord st
=> (st -> Maybe sy -> [st])Transition function
-> [st]Current states
-> [st]Reached states
COmpute the eplison closure of a Ndfa.
sizeNdfa :: Ndfa st sy -> Int
The size of an automaton is the number of its states.
limit :: Eq a => (a -> a) -> a -> a
ndfaIsStDead :: Ord st => st -> [sy] -> [st] -> (st -> Maybe sy -> [st]) -> Bool
Produced by Haddock version 0.6