summaryrefslogtreecommitdiff
path: root/src/GF/Speech/CFGToFiniteState.hs
diff options
context:
space:
mode:
authorbringert <bringert@cs.chalmers.se>2007-01-05 14:34:20 +0000
committerbringert <bringert@cs.chalmers.se>2007-01-05 14:34:20 +0000
commit741dde5a2a00dc737e570a7005663c2534ea4f6d (patch)
tree6aebd85fc4d9417a0bb3fbfb450fcf3ea72101b8 /src/GF/Speech/CFGToFiniteState.hs
parent2b1c6763cc29857ba2890a12eb4330f6e03edd06 (diff)
Change input to the different SRG printers to be StateGrammar instead of CGrammar. This to allow looking at the types in SISR, and to reduce the number of argument passed from Custom.
Diffstat (limited to 'src/GF/Speech/CFGToFiniteState.hs')
-rw-r--r--src/GF/Speech/CFGToFiniteState.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/GF/Speech/CFGToFiniteState.hs b/src/GF/Speech/CFGToFiniteState.hs
index 19ff105db..0e48c66d3 100644
--- a/src/GF/Speech/CFGToFiniteState.hs
+++ b/src/GF/Speech/CFGToFiniteState.hs
@@ -27,6 +27,7 @@ import GF.Formalism.CFG
import GF.Formalism.Utilities (Symbol(..), mapSymbol, filterCats, symbol, NameProfile(..))
import GF.Conversion.Types
import GF.Infra.Ident (Ident)
+import GF.Compile.ShellState (StateGrammar)
import GF.Speech.FiniteState
import GF.Speech.Graph
@@ -56,10 +57,10 @@ data MFA a = MFA (DFA (MFALabel a)) [(String,DFA (MFALabel a))]
-cfgToFA :: String -> CGrammar -> DFA String
+cfgToFA :: String -> StateGrammar -> DFA String
cfgToFA start = minimize . compileAutomaton start . makeSimpleRegular
-makeSimpleRegular :: CGrammar -> CFRules
+makeSimpleRegular :: StateGrammar -> CFRules
makeSimpleRegular = makeRegular . removeIdenticalRules . removeEmptyCats . cfgToCFRules
--
@@ -144,15 +145,15 @@ make_fa c@(g,ns) q0 alpha q1 fa =
-- * Compile a strongly regular grammar to a DFA with sub-automata
--
-cfgToMFA :: String -> CGrammar -> MFA String
+cfgToMFA :: String -> StateGrammar -> MFA String
cfgToMFA start g = buildMFA start g
-- | Build a DFA by building and expanding an MFA
-cfgToFA' :: String -> CGrammar -> DFA String
-cfgToFA' start g = mfaToDFA $ cfgToMFA start g
+cfgToFA' :: String -> StateGrammar -> DFA String
+cfgToFA' start = mfaToDFA . cfgToMFA start
buildMFA :: Cat_ -- ^ Start category
- -> CGrammar -> MFA String
+ -> StateGrammar -> MFA String
buildMFA start g = sortSubLats $ removeUnusedSubLats mfa
where startFA = let (fa,s,f) = newFA_
in newTransition s f (MFASub start) fa