summaryrefslogtreecommitdiff
path: root/src/compiler/GFC.hs
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2010-06-09 11:32:59 +0000
committerkrasimir <krasimir@chalmers.se>2010-06-09 11:32:59 +0000
commitd6f32b3bcd03e7fe806a1b64cd370ba78dc00aa7 (patch)
tree12bc89cc43f10e80e95f7b76c52611caa5aa4b40 /src/compiler/GFC.hs
parent4e35f7e5ecfebb2503a516c84e4b7d932731a94d (diff)
dead code elimination for PGF. Note: the produced grammars will not work well with metavariables and high-order abstract syntax
Diffstat (limited to 'src/compiler/GFC.hs')
-rw-r--r--src/compiler/GFC.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/compiler/GFC.hs b/src/compiler/GFC.hs
index 1f0ac870b..352827f6d 100644
--- a/src/compiler/GFC.hs
+++ b/src/compiler/GFC.hs
@@ -4,6 +4,7 @@ module GFC (mainGFC) where
import PGF
import PGF.CId
import PGF.Data
+import PGF.Optimize
import GF.Compile
import GF.Compile.Export
@@ -55,7 +56,8 @@ compileCFFiles opts fs =
unionPGFFiles :: Options -> [FilePath] -> IOE ()
unionPGFFiles opts fs =
do pgfs <- mapM readPGFVerbose fs
- let pgf = foldl1 unionPGF pgfs
+ let pgf0 = foldl1 unionPGF pgfs
+ pgf = if flag optOptimizePGF opts then optimizePGF pgf0 else pgf0
pgfFile = grammarName opts pgf <.> "pgf"
if pgfFile `elem` fs
then putStrLnE $ "Refusing to overwrite " ++ pgfFile