diff options
| author | krasimir <krasimir@chalmers.se> | 2008-05-30 11:15:33 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2008-05-30 11:15:33 +0000 |
| commit | 8bb0c32a9cf2cbad0375ab5886b7f2be37109477 (patch) | |
| tree | 2290b07d391a1da4e94ee367b445a6b2f64ca2cd /src-3.0/GF/Compile.hs | |
| parent | 1172539a9544ed999c565053b79cf6a30ec14de4 (diff) | |
replace GFCC with PGF in (almost) all places
Diffstat (limited to 'src-3.0/GF/Compile.hs')
| -rw-r--r-- | src-3.0/GF/Compile.hs | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src-3.0/GF/Compile.hs b/src-3.0/GF/Compile.hs index fb1f8ba0b..677aa4104 100644 --- a/src-3.0/GF/Compile.hs +++ b/src-3.0/GF/Compile.hs @@ -1,4 +1,4 @@ -module GF.Compile (batchCompile, link, compileToGFCC) where +module GF.Compile (batchCompile, link, compileToPGF) where -- the main compiler passes import GF.Compile.GetGrammar @@ -39,27 +39,31 @@ import PGF.Check import PGF.Data --- | Compiles a number of source files and builds a 'GFCC' structure for them. -compileToGFCC :: Options -> [FilePath] -> IOE GFCC -compileToGFCC opts fs = +-- | Compiles a number of source files and builds a 'PGF' structure for them. +compileToPGF :: Options -> [FilePath] -> IOE PGF +compileToPGF opts fs = do gr <- batchCompile opts fs let name = justModuleName (last fs) link opts name gr -link :: Options -> String -> SourceGrammar -> IOE GFCC +link :: Options -> String -> SourceGrammar -> IOE PGF link opts cnc gr = do gc1 <- putPointE Normal opts "linking ... " $ let (abs,gc0) = mkCanon2gfcc opts cnc gr - in ioeIO $ checkGFCCio gc0 + in case checkPGF gc0 of + Ok (gc,b) -> do + ioeIO $ putStrLn $ if b then "OK" else "Corrupted PGF" + return gc + Bad s -> fail s return $ buildParser opts $ optimize opts gc1 -optimize :: Options -> GFCC -> GFCC +optimize :: Options -> PGF -> PGF optimize opts = cse . suf where os = moduleFlag optOptimizations opts cse = if OptCSE `elem` os then cseOptimize else id suf = if OptStem `elem` os then suffixOptimize else id -buildParser :: Options -> GFCC -> GFCC +buildParser :: Options -> PGF -> PGF buildParser opts = if moduleFlag optBuildParser opts then addParsers else id |
