diff options
| author | kr.angelov <kr.angelov@gmail.com> | 2014-05-24 07:47:06 +0000 |
|---|---|---|
| committer | kr.angelov <kr.angelov@gmail.com> | 2014-05-24 07:47:06 +0000 |
| commit | 67f64cb233edb899b2b1ad550ae8c832960fb7a2 (patch) | |
| tree | 630dea18b83e342ec817e8ab5a2ba6d3e48c80a2 /src/compiler/GFC.hs | |
| parent | dbb4fdd0f7897943c9b9063fbdb256bb510a2b2b (diff) | |
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
Diffstat (limited to 'src/compiler/GFC.hs')
| -rw-r--r-- | src/compiler/GFC.hs | 12 |
1 files changed, 6 insertions, 6 deletions
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 = |
