summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Compile.hs
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2014-10-22 15:45:52 +0000
committerhallgren <hallgren@chalmers.se>2014-10-22 15:45:52 +0000
commit6ee67cd04ffbce375d7f10e74a5d9eb742d6428d (patch)
treefa90c0a4d72b30bbe486db51b2ebab81c0767fe9 /src/compiler/GF/Compile.hs
parent00922153aa1f94754847f60a959f3849dfc4771b (diff)
Various small changes for improved documentation
Diffstat (limited to 'src/compiler/GF/Compile.hs')
-rw-r--r--src/compiler/GF/Compile.hs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/compiler/GF/Compile.hs b/src/compiler/GF/Compile.hs
index 2aee8e519..719cb756c 100644
--- a/src/compiler/GF/Compile.hs
+++ b/src/compiler/GF/Compile.hs
@@ -1,4 +1,4 @@
-module GF.Compile (batchCompile, link, srcAbsName, compileToPGF) where
+module GF.Compile (compileToPGF, link, batchCompile, srcAbsName) where
import GF.Compile.GrammarToPGF(mkCanon2pgf)
import GF.Compile.ReadFiles(ModEnv,getOptionsFromFile,getAllFiles,
@@ -26,14 +26,14 @@ import PGF.Internal(optimizePGF)
import PGF(PGF,defaultProbabilities,setProbabilities,readProbabilitiesFromFile)
-- | Compiles a number of source files and builds a 'PGF' structure for them.
--- This is a composition of 'batchCompile' and 'link'.
+-- This is a composition of 'link' and 'batchCompile'.
compileToPGF :: Options -> [FilePath] -> IOE PGF
-compileToPGF opts fs = link opts =<< batchCompile opts fs
+compileToPGF opts fs = link opts . snd =<< batchCompile opts fs
-- | Link a grammar into a 'PGF' that can be used to 'PGF.linearize' and
-- 'PGF.parse' with the "PGF" run-time system.
-link :: Options -> (ModuleName,t,Grammar) -> IOE PGF
-link opts (cnc,_,gr) =
+link :: Options -> (ModuleName,Grammar) -> IOE PGF
+link opts (cnc,gr) =
putPointE Normal opts "linking ... " $ do
let abs = srcAbsName gr cnc
pgf <- mkCanon2pgf opts gr abs
@@ -45,13 +45,13 @@ link opts (cnc,_,gr) =
-- | Returns the name of the abstract syntax corresponding to the named concrete syntax
srcAbsName gr cnc = err (const cnc) id $ abstractOfConcrete gr cnc
--- | Compile the given grammar files and everything they depend on
-batchCompile :: Options -> [FilePath] -> IOE (ModuleName,UTCTime,Grammar)
+-- | Compile the given grammar files and everything they depend on.
+batchCompile :: Options -> [FilePath] -> IOE (UTCTime,(ModuleName,Grammar))
batchCompile opts files = do
(gr,menv) <- foldM (compileModule opts) emptyCompileEnv files
let cnc = moduleNameS (justModuleName (last files))
t = maximum . map fst $ Map.elems menv
- return (cnc,t,gr)
+ return (t,(cnc,gr))
{-
-- to compile a set of modules, e.g. an old GF or a .cf file
compileSourceGrammar :: Options -> Grammar -> IOE Grammar