summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Compile.hs
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2010-01-17 21:35:36 +0000
committerkrasimir <krasimir@chalmers.se>2010-01-17 21:35:36 +0000
commit9b362ff231efbd43ffb4f1c6285c41a34caf3777 (patch)
tree73b226f21f4910081ca2f02b481bc6c39c7c5c7a /src/compiler/GF/Compile.hs
parentaf13bae2dfb9adaa7c4aa273961fc09cc7ba1b7a (diff)
PGF is now real synchronous PMCFG
Diffstat (limited to 'src/compiler/GF/Compile.hs')
-rw-r--r--src/compiler/GF/Compile.hs36
1 files changed, 10 insertions, 26 deletions
diff --git a/src/compiler/GF/Compile.hs b/src/compiler/GF/Compile.hs
index cef7b235a..f6d346320 100644
--- a/src/compiler/GF/Compile.hs
+++ b/src/compiler/GF/Compile.hs
@@ -6,7 +6,6 @@ import GF.Compile.Rename
import GF.Compile.CheckGrammar
import GF.Compile.Optimize
import GF.Compile.SubExOpt
-import GF.Compile.OptimizePGF
import GF.Compile.GrammarToPGF
import GF.Compile.ReadFiles
import GF.Compile.Update
@@ -54,31 +53,16 @@ compileToPGF opts fs =
link :: Options -> String -> SourceGrammar -> IOE PGF
link opts cnc gr = do
- let isv = (verbAtLeast opts Normal)
- gc1 <- putPointE Normal opts "linking ... " $
- let (abs,gc0) = mkCanon2gfcc opts cnc gr
- in case checkPGF gc0 of
- Ok (gc,b) -> do
- case (isv,b) of
- (True, True) -> ioeIO $ putStrLn "OK"
- (False,True) -> return ()
- _ -> ioeIO $ putStrLn $ "Corrupted PGF"
- return gc
- Bad s -> fail s
- ioeIO $ buildParser opts $ optimize opts gc1
-
-optimize :: Options -> PGF -> PGF
-optimize opts = cse . suf
- where os = flag optOptimizations opts
- cse = if OptCSE `Set.member` os then cseOptimize else id
- suf = if OptStem `Set.member` os then suffixOptimize else id
-
-buildParser :: Options -> PGF -> IO PGF
-buildParser opts =
- case flag optBuildParser opts of
- BuildParser -> addParsers opts
- DontBuildParser -> return
- BuildParserOnDemand -> return . mapConcretes (\cnc -> cnc { cflags = Map.insert (mkCId "parser") "ondemand" (cflags cnc) })
+ let isv = (verbAtLeast opts Normal)
+ putPointE Normal opts "linking ... " $ do
+ gc0 <- ioeIO (mkCanon2pgf opts cnc gr)
+ case checkPGF gc0 of
+ Ok (gc,b) -> do case (isv,b) of
+ (True, True) -> ioeIO $ putStrLn "OK"
+ (False,True) -> return ()
+ _ -> ioeIO $ putStrLn $ "Corrupted PGF"
+ return gc
+ Bad s -> fail s
batchCompile :: Options -> [FilePath] -> IOE SourceGrammar
batchCompile opts files = do