summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2010-02-05 22:16:44 +0000
committerkrasimir <krasimir@chalmers.se>2010-02-05 22:16:44 +0000
commit168d459c49c2563e60c37eaa12bdfb6917859c32 (patch)
treee7f9ecbebd64c5077294bf01069dfb5fcc514a7f /src
parent064cfef331cbd6ced6b8a85d02ceb11bfb2da6e2 (diff)
bugfix in GrammarToPGF related to the compilation of def rules
Diffstat (limited to 'src')
-rw-r--r--src/compiler/GF/Compile/GrammarToPGF.hs29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/compiler/GF/Compile/GrammarToPGF.hs b/src/compiler/GF/Compile/GrammarToPGF.hs
index 76b16260d..1b2b68f63 100644
--- a/src/compiler/GF/Compile/GrammarToPGF.hs
+++ b/src/compiler/GF/Compile/GrammarToPGF.hs
@@ -121,21 +121,20 @@ mkType scope t =
in C.DTyp hyps' (i2i cat) (map (mkExp scope') args)
mkExp :: [Ident] -> A.Term -> C.Expr
-mkExp scope t = case GM.termForm t of
- Ok (xs,c,args) -> mkAbs xs (mkApp (map snd (reverse xs)++scope) c (map (mkExp scope) args))
- where
- mkAbs xs t = foldr (\(b,v) -> C.EAbs (b2b b) (i2i v)) t xs
- mkApp scope c args = case c of
- Q _ c -> foldl C.EApp (C.EFun (i2i c)) args
- QC _ c -> foldl C.EApp (C.EFun (i2i c)) args
- Vr x -> case lookup x (zip scope [0..]) of
- Just i -> foldl C.EApp (C.EVar i) args
- Nothing -> foldl C.EApp (C.EMeta 0) args
- EInt i -> C.ELit (C.LInt (fromIntegral i))
- EFloat f -> C.ELit (C.LFlt f)
- K s -> C.ELit (C.LStr s)
- Meta i -> C.EMeta i
- _ -> C.EMeta 0
+mkExp scope t =
+ case t of
+ Q _ c -> C.EFun (i2i c)
+ QC _ c -> C.EFun (i2i c)
+ Vr x -> case lookup x (zip scope [0..]) of
+ Just i -> C.EVar i
+ Nothing -> C.EMeta 0
+ Abs b x t-> C.EAbs (b2b b) (i2i x) (mkExp (x:scope) t)
+ App t1 t2-> C.EApp (mkExp scope t1) (mkExp scope t2)
+ EInt i -> C.ELit (C.LInt (fromIntegral i))
+ EFloat f -> C.ELit (C.LFlt f)
+ K s -> C.ELit (C.LStr s)
+ Meta i -> C.EMeta i
+ _ -> C.EMeta 0
mkPatt scope p =
case p of