From 3814841d7d3b77b3f033cb98c1c0a04ac39435d7 Mon Sep 17 00:00:00 2001 From: hallgren Date: Tue, 5 Nov 2013 13:11:10 +0000 Subject: Eliminate mutual dependencies between the GF compiler and the PGF library + References to modules under src/compiler have been eliminated from the PGF library (under src/runtime/haskell). Only two functions had to be moved (from GF.Data.Utilities to PGF.Utilities) to make this possible, other apparent dependencies turned out to be vacuous. + In gf.cabal, the GF executable no longer directly depends on the PGF library source directory, but only on the exposed library modules. This means that there is less duplication in gf.cabal and that the 30 modules in the PGF library will no longer be compiled twice while building GF. To make this possible, additional PGF library modules have been exposed, even though they should probably be considered for internal use only. They could be collected in a PGF.Internal module, or marked as "unstable", to make this explicit. + Also, by using the -fwarn-unused-imports flag, ~220 redundant imports were found and removed, reducing the total number of imports by ~15%. --- src/compiler/GF/Compile/GrammarToPGF.hs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/compiler/GF/Compile/GrammarToPGF.hs') diff --git a/src/compiler/GF/Compile/GrammarToPGF.hs b/src/compiler/GF/Compile/GrammarToPGF.hs index b8a4f36fa..ce31d5dc1 100644 --- a/src/compiler/GF/Compile/GrammarToPGF.hs +++ b/src/compiler/GF/Compile/GrammarToPGF.hs @@ -1,24 +1,23 @@ {-# LANGUAGE BangPatterns #-} module GF.Compile.GrammarToPGF (mkCanon2pgf) where -import GF.Compile.Export +--import GF.Compile.Export import GF.Compile.GeneratePMCFG import GF.Compile.GenerateBC -import PGF.CId +import PGF(CId,mkCId,bsCId) import PGF.Data(fidInt,fidFloat,fidString,fidVar) import PGF.Optimize(updateProductionIndices) -import qualified PGF.Macros as CM +--import qualified PGF.Macros as CM import qualified PGF.Data as C import qualified PGF.Data as D import GF.Grammar.Predef -import GF.Grammar.Printer +--import GF.Grammar.Printer import GF.Grammar.Grammar import qualified GF.Grammar.Lookup as Look import qualified GF.Grammar as A import qualified GF.Grammar.Macros as GM -import qualified GF.Infra.Option as O -import GF.Compile.GeneratePMCFG +--import GF.Compile.GeneratePMCFG import GF.Infra.Ident import GF.Infra.Option @@ -26,13 +25,13 @@ import GF.Infra.UseIO (IOE) import GF.Data.Operations import Data.List -import Data.Char (isDigit,isSpace) +--import Data.Char (isDigit,isSpace) import qualified Data.Set as Set import qualified Data.Map as Map import qualified Data.IntMap as IntMap import Data.Array.IArray -import Text.PrettyPrint -import Control.Monad.Identity +--import Text.PrettyPrint +--import Control.Monad.Identity mkCanon2pgf :: Options -> SourceGrammar -> Ident -> IOE D.PGF mkCanon2pgf opts gr am = do @@ -104,7 +103,7 @@ mkCanon2pgf opts gr am = do return (seqs, ((m,id), info) : is) i2i :: Ident -> CId -i2i = CId . ident2bs +i2i = bsCId . ident2bs mkType :: [Ident] -> A.Type -> C.Type mkType scope t = -- cgit v1.2.3