From b109bcaafad0cdcadd38831799346257aae76c17 Mon Sep 17 00:00:00 2001 From: bringert Date: Wed, 14 Sep 2005 15:08:35 +0000 Subject: Parametrized the type of FAs over the state type. --- src/GF/Speech/CFGToFiniteState.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/GF/Speech/CFGToFiniteState.hs') diff --git a/src/GF/Speech/CFGToFiniteState.hs b/src/GF/Speech/CFGToFiniteState.hs index 1816e4502..73765aed0 100644 --- a/src/GF/Speech/CFGToFiniteState.hs +++ b/src/GF/Speech/CFGToFiniteState.hs @@ -5,9 +5,9 @@ -- Stability : (stable) -- Portability : (portable) -- --- > CVS $Date: 2005/09/14 15:17:29 $ +-- > CVS $Date: 2005/09/14 16:08:35 $ -- > CVS $Author: bringert $ --- > CVS $Revision: 1.3 $ +-- > CVS $Revision: 1.4 $ -- -- Approximates CFGs with finite state networks. ----------------------------------------------------------------------------- @@ -27,7 +27,7 @@ import GF.Speech.FiniteState import GF.Speech.TransformCFG cfgToFA :: Ident -- ^ Grammar name - -> Options -> CGrammar -> FA () (Maybe String) + -> Options -> CGrammar -> NFA String cfgToFA name opts = minimize . compileAutomaton start . makeSimpleRegular where start = getStartCat opts @@ -67,7 +67,7 @@ mutRecCats incAll g = equivalenceClasses $ symmetricSubrelation $ transitiveClos -- Convert a strongly regular grammar to a finite automaton. compileAutomaton :: Cat_ -- ^ Start category -> CFRules - -> FA () (Maybe Token) + -> NFA Token compileAutomaton start g = make_fa s [Cat start] f fa'' where fa = newFA () s = startState fa @@ -77,7 +77,7 @@ compileAutomaton start g = make_fa s [Cat start] f fa'' -- | The make_fa algorithm from \"Regular approximation of CFLs: a grammatical view\", -- Mark-Jan Nederhof. International Workshop on Parsing Technologies, 1997. make_fa :: State -> [Symbol Cat_ Token] -> State - -> FA () (Maybe Token) -> FA () (Maybe Token) + -> NFA Token -> NFA Token make_fa q0 alpha q1 fa = case alpha of [] -> newTransition q0 q1 Nothing fa -- cgit v1.2.3