diff options
| author | aarne <unknown> | 2003-11-11 15:44:24 +0000 |
|---|---|---|
| committer | aarne <unknown> | 2003-11-11 15:44:24 +0000 |
| commit | 54c72f5ab023c0cdac83eb28dd1f81d4cd35aeae (patch) | |
| tree | a2a41040c96a84b2bfadac0e25a9dc450aa41bfb /src/GF/Compile/Compile.hs | |
| parent | 9b47b4aa128a5cbee74aa99e5494a0b76890ec4a (diff) | |
Working with interfaces.
Working with interfaces.
Created new place for grammar parsers.
Created new script jgf2+.
Diffstat (limited to 'src/GF/Compile/Compile.hs')
| -rw-r--r-- | src/GF/Compile/Compile.hs | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/GF/Compile/Compile.hs b/src/GF/Compile/Compile.hs index edd75ef6b..cc327be37 100644 --- a/src/GF/Compile/Compile.hs +++ b/src/GF/Compile/Compile.hs @@ -13,6 +13,7 @@ import MkResource -- the main compiler passes import GetGrammar +import Extend import Rebuild import Rename import Refresh @@ -93,7 +94,7 @@ reverseModules (MGrammar ms) = MGrammar $ reverse ms keepResModules :: Options -> SourceGrammar -> SourceGrammar keepResModules opts gr = if oElem retainOpers opts - then MGrammar $ reverse [(i,mi) | (i,mi) <- modules gr, isResourceModule mi] + then MGrammar $ reverse [(i,mi) | (i,mi@(ModMod m)) <- modules gr, isModRes m] else emptyMGrammar @@ -157,7 +158,8 @@ makeSourceModule opts env@(k,gr,can) mo@(i,mi) = case mi of where putp = putPointE opts -compileSourceModule :: Options -> CompileEnv -> SourceModule -> IOE (Int,SourceModule) +compileSourceModule :: Options -> CompileEnv -> + SourceModule -> IOE (Int,SourceModule) compileSourceModule opts env@(k,gr,can) mo@(i,mi) = do let putp = putPointE opts @@ -165,16 +167,25 @@ compileSourceModule opts env@(k,gr,can) mo@(i,mi) = do mo1 <- ioeErr $ rebuildModule mos mo - mo2:_ <- putp " renaming " $ ioeErr $ renameModule mos mo1 + mo1b <- ioeErr $ extendModule mos mo1 + ---- prDebug mo1b - (mo3:_,warnings) <- putp " type checking" $ ioeErr $ showCheckModule mos mo2 - putStrE warnings + case mo1b of + (_,ModMod n) | not (isCompleteModule n) -> return (k,mo1b) + _ -> do + mo2:_ <- putp " renaming " $ ioeErr $ renameModule mos mo1b + + (mo3:_,warnings) <- putp " type checking" $ ioeErr $ showCheckModule mos mo2 + putStrE warnings - (k',mo3r:_) <- ioeErr $ refreshModule (k,mos) mo3 + (k',mo3r:_) <- ioeErr $ refreshModule (k,mos) mo3 - mo4:_ <- putp " optimizing " $ ioeErr $ evalModule mos mo3r + mo4:_ <- putp " optimizing " $ ioeErr $ evalModule mos mo3r + + return (k',mo4) + where + prDebug mo = ioeIO $ putStrLn $ prGrammar $ MGrammar [mo] ---- debug - return (k',mo4) generateModuleCode :: Options -> InitPath -> SourceModule -> IOE GFC.CanonModule generateModuleCode opts path minfo@(name,info) = do @@ -186,7 +197,7 @@ generateModuleCode opts path minfo@(name,info) = do -- for resource, also emit gfr case info of - ModMod m | isResourceModule info && isCompilable info && emit && nomulti -> do + ModMod m | isModRes m && isCompilable info && emit && nomulti -> do let (file,out) = (gfrFile pname, prGrammar (MGrammar [minfo])) ioeIO $ writeFile file out >> putStr (" wrote file" +++ file) _ -> return () |
