From b97d6abb8190cdcb595b9bf48051cc4a98f01156 Mon Sep 17 00:00:00 2001 From: krasimir Date: Sun, 6 Sep 2009 20:31:52 +0000 Subject: hopefully complete and correct typechecker in PGF --- src/GF/Command/TreeOperations.hs | 36 +----------------------------------- 1 file changed, 1 insertion(+), 35 deletions(-) (limited to 'src/GF/Command/TreeOperations.hs') diff --git a/src/GF/Command/TreeOperations.hs b/src/GF/Command/TreeOperations.hs index 262ce35b5..45f927afc 100644 --- a/src/GF/Command/TreeOperations.hs +++ b/src/GF/Command/TreeOperations.hs @@ -20,9 +20,7 @@ allTreeOps pgf = [ ("paraphrase",("paraphrase by using semantic definitions (def)", map tree2expr . nub . concatMap (paraphrase pgf . expr2tree))), ("smallest",("sort trees from smallest to largest, in number of nodes", - smallest)), - ("typecheck",("type check and solve metavariables; reject if incorrect", - concatMap (typecheck pgf))) + smallest)) ] smallest :: [Expr] -> [Expr] @@ -31,35 +29,3 @@ smallest = sortBy (\t u -> compare (size t) (size u)) where EAbs _ e -> size e + 1 EApp e1 e2 -> size e1 + size e2 + 1 _ -> 1 - -{- -toTree :: G.Term -> Tree -toTree t = case M.termForm t of - Ok (xx,f,aa) -> Abs xx (Fun f (map toTree aa)) - -fromTree :: Tree -> G.Term -fromTree t = case t of - Abs xx b -> M.mkAbs xx (fromTree b) - Var x -> M.vr x - Fun f ts -> M.mkApp f (map fromTree ts) --} - -{- -data Tree = - Abs [CId] Tree -- ^ lambda abstraction. The list of variables is non-empty - | Var CId -- ^ variable - | Fun CId [Tree] -- ^ function application - | Lit Literal -- ^ literal - | Meta Int -- ^ meta variable - -data Literal = - LStr String -- ^ string constant - | LInt Integer -- ^ integer constant - | LFlt Double -- ^ floating point constant - -mkType :: A.Type -> C.Type -mkType t = case GM.typeForm t of - Ok (hyps,(_,cat),args) -> C.DTyp (mkContext hyps) (i2i cat) (map mkExp args) - -mkExp :: A.Term -> C.Expr --} -- cgit v1.2.3