From 962c1477b9cc6e36362a0ff2813d8805443b1db3 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Wed, 14 May 2008 11:59:33 +0000 Subject: [PATCH] Added a special type for marking the type of numeric literals to be inferred later --- common/ShowCode.hs | 3 ++- data/AST.hs | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/common/ShowCode.hs b/common/ShowCode.hs index 2e3246f..c3031db 100644 --- a/common/ShowCode.hs +++ b/common/ShowCode.hs @@ -226,7 +226,7 @@ instance ShowOccam A.Type where showOccamM (A.Timer _) = tell ["TIMER"] showOccamM A.Time = tell ["TIME"] showOccamM A.Infer = tell ["(inferred type)"] - + showOccamM (A.InferNum n) = tell ["(inferred numeric type: ",show n,")"] showOccamM (A.Mobile t) = tell ["MOBILE "] >> showOccamM t showOccamM (A.Array ds t) = (sequence dims) >> showOccamM t @@ -268,6 +268,7 @@ instance ShowRain A.Type where showRainM (A.Mobile t) = showRainM t showRainM (A.List t) = tell ["["] >> showRainM t >> tell ["]"] showRainM A.Infer = tell ["(inferred type)"] + showRainM (A.InferNum n) = tell ["(inferred numeric type: ",show n,")"] showRainM x = tell [""] instance ShowOccam A.DyadicOp where diff --git a/data/AST.hs b/data/AST.hs index b406995..4989d1e 100644 --- a/data/AST.hs +++ b/data/AST.hs @@ -144,6 +144,9 @@ data Type = | Mobile Type -- | A type that will be inferred automatically by a pass. | Infer + -- | A numeric type to be inferred later, that must be able to hold the given + -- value + | InferNum Integer deriving (Show, Eq, Typeable, Data) -- | An array dimension.