From 67f64cb233edb899b2b1ad550ae8c832960fb7a2 Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Sat, 24 May 2014 07:47:06 +0000 Subject: now we compile context-free grammars directly to PGF without going via GF source code. This makes it quick and lightweight to compile big grammars such as the Berkley grammar --- src/compiler/GFC.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/compiler/GFC.hs') diff --git a/src/compiler/GFC.hs b/src/compiler/GFC.hs index 8d548e449..b9ad7051a 100644 --- a/src/compiler/GFC.hs +++ b/src/compiler/GFC.hs @@ -12,7 +12,7 @@ import GF.Compile.CFGtoPGF import GF.Compile.GetGrammar import GF.Grammar.CFG -import GF.Infra.Ident(identS,showIdent) +import GF.Infra.Ident(showIdent) import GF.Infra.UseIO import GF.Infra.Option import GF.Data.ErrM @@ -68,13 +68,13 @@ compileCFFiles opts fs = do startCat <- case rules of (CFRule cat _ _ : _) -> return cat _ -> fail "empty CFG" - let gf = cf2gf (last fs) (uniqueFuns (mkCFG startCat Set.empty rules)) - gr <- compileSourceGrammar opts gf + let pgf = cf2pgf (last fs) (uniqueFuns (mkCFG startCat Set.empty rules)) let cnc = justModuleName (last fs) unless (flag optStopAfterPhase opts == Compile) $ - do pgf <- link opts (identS cnc, (), gr) - writePGF opts pgf - writeOutputs opts pgf + do probs <- liftIO (maybe (return . defaultProbabilities) readProbabilitiesFromFile (flag optProbsFile opts) pgf) + let pgf' = setProbabilities probs $ if flag optOptimizePGF opts then optimizePGF pgf else pgf + writePGF opts pgf' + writeOutputs opts pgf' unionPGFFiles :: Options -> [FilePath] -> IOE () unionPGFFiles opts fs = -- cgit v1.2.3