From 0df428f67672db267bd190c1d7b5f05d32a482f3 Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Thu, 22 May 2008 12:57:33 +0000 Subject: [PATCH] move GF.Devel.Compile and GF.Compile.API to GF.Compile --- src-3.0/GF/Command/Importing.hs | 2 +- src-3.0/GF/{Devel => }/Compile.hs | 24 ++++++++++++++++++++---- src-3.0/GF/Compile/API.hs | 21 --------------------- src-3.0/GF/Devel/GFC.hs | 2 +- 4 files changed, 22 insertions(+), 27 deletions(-) rename src-3.0/GF/{Devel => }/Compile.hs (90%) delete mode 100644 src-3.0/GF/Compile/API.hs diff --git a/src-3.0/GF/Command/Importing.hs b/src-3.0/GF/Command/Importing.hs index a09ba8de6..bca59048f 100644 --- a/src-3.0/GF/Command/Importing.hs +++ b/src-3.0/GF/Command/Importing.hs @@ -1,6 +1,6 @@ module GF.Command.Importing (importGrammar) where -import GF.Compile.API +import GF.Compile import GF.GFCC.DataGFCC import GF.GFCC.API diff --git a/src-3.0/GF/Devel/Compile.hs b/src-3.0/GF/Compile.hs similarity index 90% rename from src-3.0/GF/Devel/Compile.hs rename to src-3.0/GF/Compile.hs index b746812f7..dba6c96cc 100644 --- a/src-3.0/GF/Devel/Compile.hs +++ b/src-3.0/GF/Compile.hs @@ -1,4 +1,4 @@ -module GF.Devel.Compile (batchCompile) where +module GF.Compile (batchCompile, compileToGFCC) where -- the main compiler passes import GF.Devel.GetGrammar @@ -8,10 +8,8 @@ import GF.Compile.Rename import GF.Grammar.Refresh import GF.Devel.CheckGrammar import GF.Devel.Optimize ---import GF.Compile.Evaluate ---- import GF.Devel.OptimizeGF ---import GF.Canon.Share ---import GF.Canon.Subexpressions (elimSubtermsMod,unSubelimModule) +import GF.Devel.GrammarToGFCC import GF.Grammar.Grammar import GF.Infra.Ident @@ -36,6 +34,24 @@ import System.FilePath import System.Time import qualified Data.Map as Map +import GF.GFCC.OptimizeGFCC +import GF.GFCC.CheckGFCC +import GF.GFCC.DataGFCC + + +-- | Compiles a number of source files and builds a 'GFCC' structure for them. +compileToGFCC :: Options -> [FilePath] -> IOE GFCC +compileToGFCC opts fs = + do gr <- batchCompile opts fs + let name = justModuleName (last fs) + gc1 <- putPointE opts "linking ... " $ + let (abs,gc0) = mkCanon2gfcc opts name gr + in ioeIO $ checkGFCCio gc0 + let opt = if oElem (iOpt "noopt") opts then id else optGFCC + par = if oElem (iOpt "noparse") opts then id else addParsers + return (par (opt gc1)) + + batchCompile :: Options -> [FilePath] -> IOE SourceGrammar batchCompile opts files = do (_,gr,_) <- foldM (compileModule defOpts) emptyCompileEnv files diff --git a/src-3.0/GF/Compile/API.hs b/src-3.0/GF/Compile/API.hs deleted file mode 100644 index 7e852cf7a..000000000 --- a/src-3.0/GF/Compile/API.hs +++ /dev/null @@ -1,21 +0,0 @@ -module GF.Compile.API (batchCompile, compileToGFCC) where - -import GF.Devel.Compile -import GF.Devel.GrammarToGFCC -import GF.GFCC.OptimizeGFCC -import GF.GFCC.CheckGFCC -import GF.GFCC.DataGFCC -import GF.Infra.Option -import GF.Devel.UseIO - --- | Compiles a number of source files and builds a 'GFCC' structure for them. -compileToGFCC :: Options -> [FilePath] -> IOE GFCC -compileToGFCC opts fs = - do gr <- batchCompile opts fs - let name = justModuleName (last fs) - gc1 <- putPointE opts "linking ... " $ - let (abs,gc0) = mkCanon2gfcc opts name gr - in ioeIO $ checkGFCCio gc0 - let opt = if oElem (iOpt "noopt") opts then id else optGFCC - par = if oElem (iOpt "noparse") opts then id else addParsers - return (par (opt gc1)) diff --git a/src-3.0/GF/Devel/GFC.hs b/src-3.0/GF/Devel/GFC.hs index 13e47e788..562570f14 100644 --- a/src-3.0/GF/Devel/GFC.hs +++ b/src-3.0/GF/Devel/GFC.hs @@ -1,7 +1,7 @@ module GF.Devel.GFC (mainGFC) where -- module Main where -import GF.Compile.API +import GF.Compile import GF.Devel.PrintGFCC import GF.GFCC.CId import GF.GFCC.DataGFCC