diff options
| author | peb <peb@cs.chalmers.se> | 2006-04-04 09:33:22 +0000 |
|---|---|---|
| committer | peb <peb@cs.chalmers.se> | 2006-04-04 09:33:22 +0000 |
| commit | c437f63404dc0a4fdb42cd6eff661b071d3fca1d (patch) | |
| tree | a455ae560107cdf92cc942bd61d124d3fcb67130 /src/GF/Conversion/GFCtoSimple.hs | |
| parent | f1000ca8c3c07f851f1f278fc75fdf7caec9848e (diff) | |
adding support for 2nd order functions in SimpleGFC format
Diffstat (limited to 'src/GF/Conversion/GFCtoSimple.hs')
| -rw-r--r-- | src/GF/Conversion/GFCtoSimple.hs | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/GF/Conversion/GFCtoSimple.hs b/src/GF/Conversion/GFCtoSimple.hs index 72b774e16..a01deb08a 100644 --- a/src/GF/Conversion/GFCtoSimple.hs +++ b/src/GF/Conversion/GFCtoSimple.hs @@ -1,4 +1,4 @@ ----------------------------------------------------------------------- +--------------------------------------------------------------------- -- | -- Maintainer : PL -- Stability : (stable) @@ -63,17 +63,21 @@ convertAbsFun gram fun typing = -- trace2 "GFCtoSimple - converting function" (p convertAbstract :: [SDecl] -> Fun -> A.Exp -> Abstract SDecl Name convertAbstract env fun (A.EProd x a b) - = convertAbstract (convertType x' [] a : env) fun b + = convertAbstract (convertAbsType x' [] a : env) fun b where x' = if x==I.identC "h_" then anyVar else x convertAbstract env fun a - = Abs (convertType anyVar [] a) (reverse env) name + = Abs (convertAbsType anyVar [] a) (reverse env) name where name = Name fun [ Unify [n] | n <- [0 .. length env-1] ] -convertType :: Var -> [TTerm] -> A.Exp -> SDecl -convertType x args (A.EApp a b) = convertType x (convertExp [] b : args) a -convertType x args (A.EAtom at) = Decl x (convertCat at) args -convertType x args (A.EProd _ _ b) = convertType x args b ---- AR 7/10 workaround -convertType x args exp = error $ "GFCtoSimple.convertType: " ++ prt exp +convertAbsType :: Var -> [FOType SCat] -> A.Exp -> SDecl +convertAbsType x args (A.EProd _ a b) = convertAbsType x (convertType [] a : args) b +convertAbsType x args a = Decl x (reverse args ::--> convertType [] a) + +convertType :: [TTerm] -> A.Exp -> FOType SCat +convertType args (A.EApp a b) = convertType (convertExp [] b : args) a +convertType args (A.EAtom at) = convertCat at ::@ reverse args +convertType args (A.EProd _ _ b) = convertType args b ---- AR 7/10 workaround +convertType args exp = error $ "GFCtoSimple.convertType: " ++ prt exp {- Exp from GF/Canon/GFC.cf: EApp. Exp1 ::= Exp1 Exp2 ; |
