module FST.AutomatonInterface (
module FST.RegTypes,
module FST.AutomatonTypes,
Automaton,
compile,
compileNFA,
determinize,
minimize,
complete,
initial,
numberOfStates,
numberOfTransitions,
showAutomaton,
) where
import FST.Automaton
import FST.AutomatonTypes
import FST.Complete
import qualified FST.Deterministic as D
import qualified FST.LBFA as L
import FST.RegTypes hiding (reversal)
import FST.Reversal (reversal)
compileNFA :: Ord a => Reg a -> Sigma a -> StateTy -> Automaton a
compileNFA = L.compileToAutomaton
minimize :: Ord a => Automaton a -> Automaton a
minimize = determinize . reversal . determinize . reversal
determinize :: Ord a => Automaton a -> Automaton a
determinize = D.determinize
compile :: Ord a => Reg a -> Sigma a -> StateTy -> Automaton a
compile reg sigma s = minimize $ L.compileToAutomaton reg sigma s
initial :: Automaton a -> StateTy
initial automaton = head $ initials automaton
numberOfStates :: Ord a => Automaton a -> Int
numberOfStates auto = length $ states auto
numberOfTransitions :: Ord a => Automaton a -> Int
numberOfTransitions auto = sum [length (transitionList auto s)
| s <- states auto]