summaryrefslogtreecommitdiff
path: root/src/GF/Compile/GrammarToCanon.hs
diff options
context:
space:
mode:
authoraarne <unknown>2005-02-05 20:52:31 +0000
committeraarne <unknown>2005-02-05 20:52:31 +0000
commita1e8229910bbd01135d0e71c459872f87785a291 (patch)
tree16612ffa6d974da1fb8e4234f134e5f97c0ad9af /src/GF/Compile/GrammarToCanon.hs
parent45f3b7d5e74dde250a3e0eb92469efc22479cd30 (diff)
cleand up Structural
Diffstat (limited to 'src/GF/Compile/GrammarToCanon.hs')
-rw-r--r--src/GF/Compile/GrammarToCanon.hs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/GF/Compile/GrammarToCanon.hs b/src/GF/Compile/GrammarToCanon.hs
index 5ec5c8091..c090f1622 100644
--- a/src/GF/Compile/GrammarToCanon.hs
+++ b/src/GF/Compile/GrammarToCanon.hs
@@ -9,7 +9,7 @@
-- > CVS $Author $
-- > CVS $Revision $
--
--- (Description of the module)
+-- Code generator from optimized GF source code to GFC.
-----------------------------------------------------------------------------
module GrammarToCanon where
@@ -187,7 +187,9 @@ redCType t = case t of
redCTerm :: Term -> Err G.Term
redCTerm t = case t of
- Vr x -> liftM G.Arg $ redArgvar x
+ Vr x -> checkAgain
+ (liftM G.Arg $ redArgvar x)
+ (liftM G.LI $ redIdent x) --- for parametrize optimization
App _ _ -> do -- only constructor applications can remain
(_,c,xx) <- termForm t
xx' <- mapM redCTerm xx
@@ -212,6 +214,13 @@ redCTerm t = case t of
ps' <- mapM redPatt ps
ts' <- mapM redCTerm ts
return $ G.T ty' $ map (uncurry G.Cas) $ zip (map singleton ps') ts'
+ TSh i cs -> do
+ ty <- getTableType i
+ ty' <- redCType ty
+ let (pss,ts) = unzip cs
+ pss' <- mapM (mapM redPatt) pss
+ ts' <- mapM redCTerm ts
+ return $ G.T ty' $ map (uncurry G.Cas) $ zip pss' ts'
V ty ts -> do
ty' <- redCType ty
ts' <- mapM redCTerm ts
@@ -247,6 +256,7 @@ redPatt p = case p of
return $ G.PR $ map (uncurry G.PAss) $ zip ls' ts
PT _ q -> redPatt q
PInt i -> return $ G.PI (toInteger i)
+ PV x -> liftM G.PV $ redIdent x --- for parametrize optimization
_ -> prtBad "cannot reduce pattern" p
redLabel :: Label -> G.Label