summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Compiler.hs
diff options
context:
space:
mode:
authorThomas Hallgren <th-github@altocumulus.org>2019-01-22 17:16:32 +0100
committerThomas Hallgren <th-github@altocumulus.org>2019-01-22 17:16:32 +0100
commite4abff772556ebee68a7e3b2cbe4fd413a5e845e (patch)
treeaa15cf56c3f30718de75eba48a175242266c4cbf /src/compiler/GF/Compiler.hs
parenta40130ddc445110871c7c406b1c562d7d726f393 (diff)
More work on the canonica_gf export
+ Abstract syntax now is converted directly from the Grammar and not via PGF, so you can use `gf -batch -no-pmcfg -f canonical_gf ...`, to export to canonical_gf while skipping PMCFG and PGF file generation completely. + Flags that are normally copied to PGF files are now included in the caninical_gf output as well (in particular the startcat flag).
Diffstat (limited to 'src/compiler/GF/Compiler.hs')
-rw-r--r--src/compiler/GF/Compiler.hs17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/compiler/GF/Compiler.hs b/src/compiler/GF/Compiler.hs
index 334bbd592..2bd0fc0cb 100644
--- a/src/compiler/GF/Compiler.hs
+++ b/src/compiler/GF/Compiler.hs
@@ -7,7 +7,7 @@ import GF.Compile as S(batchCompile,link,srcAbsName)
import GF.CompileInParallel as P(parallelBatchCompile)
import GF.Compile.Export
import GF.Compile.ConcreteToHaskell(concretes2haskell)
-import GF.Compile.ConcreteToCanonical(concretes2canonical)
+import GF.Compile.ConcreteToCanonical--(concretes2canonical)
import GF.Compile.CFGtoPGF
import GF.Compile.GetGrammar
import GF.Grammar.BNFC
@@ -60,17 +60,24 @@ compileSourceFiles opts fs =
do when (FmtHaskell `elem` ofmts && haskellOption opts HaskellConcrete) $
mapM_ cnc2haskell (snd output)
when (FmtCanonicalGF `elem` ofmts) $
- mapM_ cnc2canonical (snd output)
+ do createDirectoryIfMissing False "canonical"
+ mapM_ abs2canonical (snd output)
+ mapM_ cnc2canonical (snd output)
where
ofmts = flag optOutputFormats opts
cnc2haskell (cnc,gr) =
do mapM_ writeExport $ concretes2haskell opts (srcAbsName gr cnc) gr
+ abs2canonical (cnc,gr) =
+ writeExport ("canonical/"++render absname++".gf",render80 canAbs)
+ where
+ absname = srcAbsName gr cnc
+ canAbs = abstract2canonical absname gr
+
cnc2canonical (cnc,gr) =
- do createDirectoryIfMissing False "canonical"
- mapM_ (writeExport.fmap render80) $
- concretes2canonical opts (srcAbsName gr cnc) gr
+ mapM_ (writeExport.fmap render80) $
+ concretes2canonical opts (srcAbsName gr cnc) gr
writeExport (path,s) = writing opts path $ writeUTF8File path s