summaryrefslogtreecommitdiff
path: root/src/GF/CFGM
diff options
context:
space:
mode:
authorbringert <unknown>2005-04-15 08:45:32 +0000
committerbringert <unknown>2005-04-15 08:45:32 +0000
commit2c36d9c62386c6d06a40c4b6ed4a12e96119b5ae (patch)
tree7489f901458afb66e86a741e7e2dae14d94c08a5 /src/GF/CFGM
parent5207c27bffd077f1ab322824b485fc6c92d554eb (diff)
Removed some dead code from gsl and cfgm generation.
Diffstat (limited to 'src/GF/CFGM')
-rw-r--r--src/GF/CFGM/PrintCFGrammar.hs38
1 files changed, 4 insertions, 34 deletions
diff --git a/src/GF/CFGM/PrintCFGrammar.hs b/src/GF/CFGM/PrintCFGrammar.hs
index bb213e32b..a0bc4ea9c 100644
--- a/src/GF/CFGM/PrintCFGrammar.hs
+++ b/src/GF/CFGM/PrintCFGrammar.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date: 2005/04/14 18:38:36 $
--- > CVS $Author: peb $
--- > CVS $Revision: 1.14 $
+-- > CVS $Date: 2005/04/15 09:45:32 $
+-- > CVS $Author: bringert $
+-- > CVS $Revision: 1.15 $
--
-- Handles printing a CFGrammar in CFGM format.
-----------------------------------------------------------------------------
@@ -20,12 +20,6 @@ import Ident
import GFC
import Modules
--- import qualified GF.OldParsing.ConvertGrammar as Cnv
--- import qualified GF.Printing.PrintParser as Prt
--- import qualified GF.OldParsing.CFGrammar as CFGrammar
--- import qualified GF.OldParsing.GrammarTypes as GT
--- import qualified AbsCFG
--- import qualified GF.OldParsing.Utilities as Parser
import qualified GF.Conversion.GFC as Cnv
import GF.Infra.Print (prt)
import GF.Formalism.CFG (CFRule(..))
@@ -39,7 +33,6 @@ import qualified Option
import List (intersperse)
import Maybe (listToMaybe, maybe)
--- | FIXME: fix warning about bad -printer= value
prCanonAsCFGM :: CanonGrammar -> String
prCanonAsCFGM gr = unlines $ map (uncurry (prLangAsCFGM gr)) xs
where
@@ -60,17 +53,6 @@ prLangAsCFGM gr i start = prCFGrammarAsCFGM (Cnv.gfc2cfg (gr, i)) i start
-- prLangAsCFGM gr i start = prCFGrammarAsCFGM (Cnv.cfg (Cnv.pInfo opts gr i)) i start
-- where opts = Option.Opts [Option.gfcConversion "nondet"]
-{-
-prCFGrammarAsCFGM :: GT.CFGrammar -> Ident -> Maybe String -> String
-prCFGrammarAsCFGM gr i@(IC lang) start = (header . startcat . rules . footer) ""
- where
- header = showString "grammar " . showString lang . showString "\n"
- startcat = maybe id (\s -> showString "startcat " . showString (s++"{}.s") . showString ";\n") start
- rules0 = map prt gr
- rules = showString $ concat $ map (\l -> init l++";\n") rules0
- footer = showString "end grammar\n"
--}
-
prCFGrammarAsCFGM :: GT.CGrammar -> Ident -> Maybe String -> String
prCFGrammarAsCFGM gr i start = PrintCFG.printTree $ cfGrammarToCFGM gr i start
@@ -79,7 +61,6 @@ cfGrammarToCFGM gr i start = AbsCFG.Grammar (identToCFGMIdent i) flags (map rule
where flags = maybe [] (\c -> [AbsCFG.StartCat $ strToCFGMCat (c++"{}.s")]) start
ruleToCFGMRule :: GT.CRule -> AbsCFG.Rule
--- new version, without the MCFName constructor:
ruleToCFGMRule (CFRule c rhs (GT.Name fun profile))
= AbsCFG.Rule fun' p' c' rhs'
where
@@ -88,22 +69,11 @@ ruleToCFGMRule (CFRule c rhs (GT.Name fun profile))
c' = catToCFGMCat c
rhs' = map symbolToGFCMSymbol rhs
-{- old version, with the MCFName constructor:
-ruleToCFGMRule (CFGrammar.Rule c rhs (GT.CFName (GT.MCFName fun cat args) lbl profile))
- = AbsCFG.Rule fun' n' p' c' rhs'
- where
- fun' = identToCFGMIdent fun
- n' = strToCFGMName (prt cat ++ concat [ "/" ++ prt arg | arg <- args ] ++ prt lbl)
- p' = profileToCFGMProfile profile
- c' = catToCFGMCat c
- rhs' = map symbolToGFCMSymbol rhs
--}
-
profileToCFGMProfile :: [GT.Profile a] -> AbsCFG.Profile
profileToCFGMProfile = AbsCFG.Profile . map cnvProfile
where cnvProfile (GT.Unify ns) = AbsCFG.Ints $ map fromIntegral ns
cnvProfile (GT.Constant a) = AbsCFG.Ints []
- -- this should be replaced with a new constructor in 'AbsCFG'
+ -- FIXME: this should be replaced with a new constructor in 'AbsCFG'
identToCFGMIdent :: Ident -> AbsCFG.Ident
identToCFGMIdent = AbsCFG.Ident . prt