diff options
| author | krasimir <krasimir@chalmers.se> | 2009-10-02 23:34:35 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2009-10-02 23:34:35 +0000 |
| commit | 4c77dcf9388315411539b513aaac5f48b5c875ad (patch) | |
| tree | 0a857e4c41fee417a35d41a0e3adffc9c100a3de /src/GF/Compile | |
| parent | d64419f2f25f0fb5a28bddf198dce6ac26b75296 (diff) | |
merge GF.Grammar.API into GF.Grammar
Diffstat (limited to 'src/GF/Compile')
| -rw-r--r-- | src/GF/Compile/AbsCompute.hs | 4 | ||||
| -rw-r--r-- | src/GF/Compile/TypeCheck.hs | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/GF/Compile/AbsCompute.hs b/src/GF/Compile/AbsCompute.hs index 3f4c6d061..bfc824d82 100644 --- a/src/GF/Compile/AbsCompute.hs +++ b/src/GF/Compile/AbsCompute.hs @@ -36,10 +36,10 @@ import Text.PrettyPrint tracd m t = t -- tracd = trace -compute :: Grammar -> Exp -> Err Exp +compute :: SourceGrammar -> Exp -> Err Exp compute = computeAbsTerm -computeAbsTerm :: Grammar -> Exp -> Err Exp +computeAbsTerm :: SourceGrammar -> Exp -> Err Exp computeAbsTerm gr = computeAbsTermIn (lookupAbsDef gr) [] -- | a hack to make compute work on source grammar as well diff --git a/src/GF/Compile/TypeCheck.hs b/src/GF/Compile/TypeCheck.hs index 05b0b288a..aefcf4d25 100644 --- a/src/GF/Compile/TypeCheck.hs +++ b/src/GF/Compile/TypeCheck.hs @@ -49,7 +49,7 @@ cont2val = type2val . cont2exp -- some top-level batch-mode checkers for the compiler -justTypeCheck :: Grammar -> Exp -> Val -> Err Constraints +justTypeCheck :: SourceGrammar -> Exp -> Val -> Err Constraints justTypeCheck gr e v = do (_,constrs0) <- checkExp (grammar2theory gr) (initTCEnv []) e v (constrs1,_) <- unifyVal constrs0 @@ -59,25 +59,25 @@ notJustMeta (c,k) = case (c,k) of (VClos g1 (Meta m1), VClos g2 (Meta m2)) -> False _ -> True -grammar2theory :: Grammar -> Theory +grammar2theory :: SourceGrammar -> Theory grammar2theory gr (m,f) = case lookupFunType gr m f of Ok t -> return $ type2val t Bad s -> case lookupCatContext gr m f of Ok cont -> return $ cont2val cont _ -> Bad s -checkContext :: Grammar -> Context -> [Message] +checkContext :: SourceGrammar -> Context -> [Message] checkContext st = checkTyp st . cont2exp -checkTyp :: Grammar -> Type -> [Message] +checkTyp :: SourceGrammar -> Type -> [Message] checkTyp gr typ = err (\x -> [text x]) ppConstrs $ justTypeCheck gr typ vType -checkDef :: Grammar -> Fun -> Type -> [Equation] -> [Message] +checkDef :: SourceGrammar -> Fun -> Type -> [Equation] -> [Message] checkDef gr (m,fun) typ eqs = err (\x -> [text x]) ppConstrs $ do bcs <- mapM (\b -> checkBranch (grammar2theory gr) (initTCEnv []) b (type2val typ)) eqs let (bs,css) = unzip bcs (constrs,_) <- unifyVal (concat css) return $ filter notJustMeta constrs -checkConstrs :: Grammar -> Cat -> [Ident] -> [String] +checkConstrs :: SourceGrammar -> Cat -> [Ident] -> [String] checkConstrs gr cat _ = [] ---- check constructors! |
