1
0
forked from GitHub/gf-core

PGF library: expose only PGF and PGF.Internal instead of all modules

PGF exports the public, stable API.
PGF.Internal exports additional things needed in the GF compiler & shell,
including the nonstardard version of Data.Binary.
This commit is contained in:
hallgren
2014-06-12 14:43:18 +00:00
parent 352ecb7eb8
commit d6252d1c16
34 changed files with 80 additions and 71 deletions

View File

@@ -4,9 +4,7 @@ import GF.Grammar.CFG
import GF.Infra.UseIO
import PGF
import PGF.Data
import PGF.Macros
import PGF.Optimize
import PGF.Internal
import qualified Data.Set as Set
import qualified Data.Map as Map

View File

@@ -1,6 +1,6 @@
module GF.Compile.Compute.Value where
import GF.Grammar.Grammar(Label,Type,MetaId,Patt,QIdent)
import PGF.Data(BindType)
import PGF.Internal(BindType)
import GF.Infra.Ident(Ident)
import Text.Show.Functions()
import Data.Ix(Ix)

View File

@@ -1,7 +1,7 @@
module GF.Compile.Export where
import PGF
import PGF.Printer(ppPGF)
import PGF.Internal(ppPGF)
import GF.Compile.PGFtoHaskell
import GF.Compile.PGFtoProlog
import GF.Compile.PGFtoLProlog

View File

@@ -2,13 +2,13 @@ module GF.Compile.GenerateBC(generateByteCode) where
import GF.Grammar
import GF.Compile.Instructions
import PGF.Data
import PGF.Internal(Binary(..),encode,BCAddr)
import Data.Maybe
import qualified Data.IntMap as IntMap
import qualified Data.ByteString as BSS
import qualified Data.ByteString.Lazy as BS
import Data.Binary
import PGF.Internal()
generateByteCode :: [(QIdent,Info)] -> ([(QIdent,Info,BCAddr)], BSS.ByteString)
generateByteCode = runGenM . mapM genFun

View File

@@ -14,7 +14,7 @@ module GF.Compile.GeneratePMCFG
) where
--import PGF.CId
import PGF.Data(CncCat(..),Symbol(..),fidVar)
import PGF.Internal as PGF(CncCat(..),Symbol(..),fidVar)
import GF.Infra.Option
import GF.Grammar hiding (Env, mkRecord, mkTable)
@@ -194,13 +194,12 @@ unfactor t = CM (\gr c -> c (unfac gr t))
Vr y | y == x -> u
_ -> composSafeOp (restore x u) t
pgfCncCat :: SourceGrammar -> Type -> Int -> PGF.Data.CncCat
pgfCncCat :: SourceGrammar -> Type -> Int -> CncCat
pgfCncCat gr lincat index =
let ((_,size),schema) = computeCatRange gr lincat
in PGF.Data.CncCat index
(index+size-1)
(mkArray (map (renderStyle style{mode=OneLineMode} . ppPath)
(getStrPaths schema)))
in PGF.CncCat index (index+size-1)
(mkArray (map (renderStyle style{mode=OneLineMode} . ppPath)
(getStrPaths schema)))
where
getStrPaths :: Schema Identity s c -> [Path]
getStrPaths = collect CNil []

View File

@@ -6,11 +6,11 @@ import GF.Compile.GeneratePMCFG
import GF.Compile.GenerateBC
import PGF(CId,mkCId,utf8CId)
import PGF.Data(fidInt,fidFloat,fidString,fidVar)
import PGF.Optimize(updateProductionIndices)
import PGF.Internal(fidInt,fidFloat,fidString,fidVar)
import PGF.Internal(updateProductionIndices)
--import qualified PGF.Macros as CM
import qualified PGF.Data as C
import qualified PGF.Data as D
import qualified PGF.Internal as C
import qualified PGF.Internal as D
import GF.Grammar.Predef
--import GF.Grammar.Printer
import GF.Grammar.Grammar

View File

@@ -1,10 +1,7 @@
module GF.Compile.Instructions where
--import Data.IORef
import Data.Binary
import Data.Binary.Put
import Data.Binary.Get
import Data.Binary.IEEE754
import PGF.Internal -- Binary
import PGF(CId)
--import PGF.CId
--import PGF.Binary

View File

@@ -17,8 +17,7 @@
module GF.Compile.PGFtoHaskell (grammar2haskell) where
import PGF(showCId)
import PGF.Data
import PGF.Macros
import PGF.Internal
import GF.Data.Operations
import GF.Infra.Option

View File

@@ -1,8 +1,7 @@
module GF.Compile.PGFtoJS (pgf2js) where
import PGF(showCId)
import PGF.Data hiding (mkStr)
import qualified PGF.Macros as M
import PGF(CId,showCId)
import PGF.Internal as M
import qualified GF.JavaScript.AbsJS as JS
import qualified GF.JavaScript.PrintJS as JS

View File

@@ -1,7 +1,7 @@
module GF.Compile.PGFtoLProlog(grammar2lambdaprolog_mod, grammar2lambdaprolog_sig) where
import PGF(mkCId,ppCId,showCId,wildCId)
import PGF.Data hiding (ppExpr, ppType, ppHypo)
import PGF.Internal hiding (ppExpr,ppType,ppHypo,ppCat,ppFun)
--import PGF.Macros
import Data.List
import Data.Maybe

View File

@@ -9,7 +9,7 @@
module GF.Compile.PGFtoProlog (grammar2prolog) where
import PGF(mkCId,wildCId,showCId)
import PGF.Data
import PGF.Internal
--import PGF.Macros
import GF.Data.Operations

View File

@@ -9,8 +9,7 @@
module GF.Compile.PGFtoPython (pgf2python) where
import PGF(showCId)
import PGF.Data
import qualified PGF.Macros as M
import PGF.Internal as M
import GF.Data.Operations

View File

@@ -2,7 +2,7 @@ module GF.Compile.ToAPI
(stringToAPI,exprToAPI)
where
import PGF.Data
import PGF.Internal
import PGF(showCId)
import Data.Maybe
--import System.IO