1
0
forked from GitHub/gf-core

floats in GF and GFC (parsing user input still doesn't work)

This commit is contained in:
aarne
2005-12-02 13:13:14 +00:00
parent e1504e6ba0
commit ef504a4cbe
34 changed files with 2366 additions and 2185 deletions

View File

@@ -279,6 +279,7 @@ computeLType gr t = do
App (Q (IC "Predef") (IC "Ints")) _ -> return ty ---- shouldn't be needed
Q (IC "Predef") (IC "Int") -> return ty ---- shouldn't be needed
Q (IC "Predef") (IC "Float") -> return ty ---- shouldn't be needed
Q m c | elem c [cPredef,cPredefAbs] -> return ty
@@ -416,6 +417,8 @@ inferLType gr trm = case trm of
EInt i -> return (trm, typeInt)
EFloat i -> return (trm, typeFloat)
Empty -> return (trm, typeTok)
C s1 s2 ->
@@ -508,6 +511,7 @@ inferLType gr trm = case trm of
PT _ p -> isConstPatt p
PString _ -> True
PInt _ -> True
PFloat _ -> True
_ -> False
inferPatt p = case p of

View File

@@ -231,7 +231,8 @@ redCTerm t = case t of
return $ G.V ty' ts'
S u v -> liftM2 G.S (redCTerm u) (redCTerm v)
K s -> return $ G.K (G.KS s)
EInt i -> return $ G.EInt $ toInteger i
EInt i -> return $ G.EInt i
EFloat i -> return $ G.EFloat i
C u v -> liftM2 G.C (redCTerm u) (redCTerm v)
FV ts -> liftM G.FV $ mapM redCTerm ts
--- Ready ss -> return $ G.Ready [redStr ss] --- obsolete
@@ -259,7 +260,8 @@ redPatt p = case p of
ts <- mapM redPatt tts
return $ G.PR $ map (uncurry G.PAss) $ zip ls' ts
PT _ q -> redPatt q
PInt i -> return $ G.PI (toInteger i)
PInt i -> return $ G.PI i
PFloat i -> return $ G.PF i
PV x -> liftM G.PV $ redIdent x --- for parametrize optimization
_ -> prtBad "cannot reduce pattern" p

View File

@@ -94,6 +94,7 @@ renameIdentTerm env@(act,imps) t =
-- this facility is mainly for BWC with GF1: you need not import PredefAbs
predefAbs c s = case c of
IC "Int" -> return $ const $ Q cPredefAbs cInt
IC "Float" -> return $ const $ Q cPredefAbs cFloat
IC "String" -> return $ const $ Q cPredefAbs cString
_ -> Bad s