|
Language.HaLex.Ndfa | Portability | portable | Stability | provisional | Maintainer | jas@di.uminho.pt |
|
|
|
|
|
Description |
Non-Deterministic Finite Automata in Haskell.
Code Included in the Lecture Notes on
Language Processing (with a functional flavour).
|
|
Synopsis |
|
|
|
|
Data type
|
|
|
Type of Non-Deterministic Finite Automata. Parameterized with
the type st of states and sy of symbols.
| Constructors | Ndfa [sy] [st] [st] [st] (st -> Maybe sy -> [st]) | |
| Instances | |
|
|
Acceptance
|
|
|
:: Ord st | | => Ndfa st sy | Automaton
| -> [sy] | Input symbols
| -> Bool | | Test whether the given automaton accepts the given list of
input symbols.
|
|
|
|
:: 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.
|
|
|
|
:: Ord st | | => st -> Maybe sy -> [st] | Transition function
| -> [st] | Current states
| -> [st] | Reached states
| Compute the eplison closure of a Ndfa.
|
|
|
Transformation
|
|
|
:: (Eq st, Eq sy) | | => ([sy], [st], [st], [st], [(st, Maybe sy, st)]) | Tuple-based Ndfa
| -> Ndfa st sy | Automaton
| Reconstruct a Ndfa from a transition table.
Given a Ndfa expressed by a transition table
(ie a list of triples of the form
(Origin,Maybe Symbol,Destination)
it constructs a Ndfa. The other elements of the
input tuple are the vocabulary, a set of
states, and the sets of initial and final states
|
|
|
Transitions
|
|
ndfaTransitionsFromTo :: Eq st => (st -> Maybe sy -> [st]) -> [sy] -> st -> st -> [Maybe sy] | Source |
|
Compute the labels with the same (giving) origin and destination
|
|
|
:: Ord st | | => st -> Maybe sy -> [st] | Transition Function
| -> [sy] | Vocabulary
| -> st | Origin
| -> [st] | Destination States
| Compute the destination states giving the origin state
|
|
|
|
:: | | => Ndfa st sy | Automaton
| -> [(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.
|
|
|
|
:: Ord st | | => st -> Maybe sy -> [st] | Transition Function
| -> [sy] | Vocabulary
| -> st | Origin
| -> [st] | Reached States
| Compute the states that can be reached from a given state
according to a given transition function and vocabulary
|
|
|
Printing
|
|
|
:: Show fa | | => fa | Automaton
| -> [Char] | Haskell module or file name
| -> IO () | | Helper function to show the transition function of a Ndfa.
Produce the transition table of a given finite automaton.
|
|
|
|
:: Eq st | | => Ndfa st sy | Automaton
| -> Int | Initial integer number
| -> Ndfa Int sy | Renamed Automaton
| Renames a Ndfa.
|
|
|
Properties of Ndfa
|
|
|
:: | | => Ndfa st sy | Automaton
| -> Int | Size
| The size of an automaton is the number of its states.
|
|
|
|
:: Ord st | | => Ndfa st sy | Automaton
| -> [st] | Dead States
| Compute the dead states of a Ndfa
|
|
|
Properties of States
|
|
|
:: Ord st | | => st -> Maybe sy -> [st] | Transition Function
| -> [sy] | Vocabulary
| -> [st] | Set of Final States
| -> st | State
| -> Bool | | Checks whether a Ndfa state is dead or not.
|
|
|
ndfanumberIncomingArrows | Source |
|
:: Eq st | | => st -> Maybe sy -> [st] | Transition Function
| -> [sy] | Vocabulary
| -> [st] | Set of States
| -> st | Destination
| -> Int | Number of Arrows
| Compute the number of incoming arrows for a given state
|
|
|
ndfanumberOutgoingArrows | Source |
|
:: Ord st | | => st -> Maybe sy -> [st] | Transition Function
| -> [sy] | Vocabulary
| -> st | Origin
| -> Int | Number of Arrows
| Compute the number of outgoing arrows for a given state
|
|
|
Produced by Haddock version 2.3.0 |