summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Compile/GrammarToPGF.hs
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2014-10-16 10:00:32 +0000
committerkr.angelov <kr.angelov@gmail.com>2014-10-16 10:00:32 +0000
commit26ad164cecc65afd9420e0ac34a15d49b02e6cbf (patch)
tree327fb80f9d2281199737f6db0ca6bdcc336729c2 /src/compiler/GF/Compile/GrammarToPGF.hs
parentb70dba87bab5dfc8039f0b9f69e0851f92324f8b (diff)
finally proper stack unwind in the evaluator
Diffstat (limited to 'src/compiler/GF/Compile/GrammarToPGF.hs')
-rw-r--r--src/compiler/GF/Compile/GrammarToPGF.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/compiler/GF/Compile/GrammarToPGF.hs b/src/compiler/GF/Compile/GrammarToPGF.hs
index b8a79af52..d0b588d81 100644
--- a/src/compiler/GF/Compile/GrammarToPGF.hs
+++ b/src/compiler/GF/Compile/GrammarToPGF.hs
@@ -50,8 +50,8 @@ mkCanon2pgf opts gr am = do
funs = Map.fromList [(i2i f, (mkType [] ty, arity, mkDef gr arity mdef, 0)) |
((m,f),AbsFun (Just (L _ ty)) ma mdef _) <- adefs,
- let arity = mkArrity ma ty]
-
+ let arity = mkArity ma mdef ty]
+
cats = Map.fromList [(i2i c, (snd (mkContext [] cont),catfuns c, 0)) |
((m,c),AbsCat (Just (L _ cont))) <- adefs]
@@ -150,9 +150,10 @@ mkDef gr arity (Just eqs) = Just ([C.Equ ps' (mkExp scope' e) | L _ (ps,e) <- eq
)
mkDef gr arity Nothing = Nothing
-mkArrity (Just a) ty = a
-mkArrity Nothing ty = let (ctxt, _, _) = GM.typeForm ty
- in length ctxt
+mkArity (Just a) _ ty = a -- known arity, i.e. defined function
+mkArity Nothing (Just _) ty = 0 -- defined function with no arity - must be an axiom
+mkArity Nothing _ ty = let (ctxt, _, _) = GM.typeForm ty -- constructor
+ in length ctxt
genCncCats gr am cm cdefs =
let (index,cats) = mkCncCats 0 cdefs