Added a special type for marking the type of numeric literals to be inferred later
This commit is contained in:
parent
ed9c92878a
commit
962c1477b9
|
@ -226,7 +226,7 @@ instance ShowOccam A.Type where
|
||||||
showOccamM (A.Timer _) = tell ["TIMER"]
|
showOccamM (A.Timer _) = tell ["TIMER"]
|
||||||
showOccamM A.Time = tell ["TIME"]
|
showOccamM A.Time = tell ["TIME"]
|
||||||
showOccamM A.Infer = tell ["(inferred type)"]
|
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.Mobile t) = tell ["MOBILE "] >> showOccamM t
|
||||||
showOccamM (A.Array ds t)
|
showOccamM (A.Array ds t)
|
||||||
= (sequence dims) >> showOccamM t
|
= (sequence dims) >> showOccamM t
|
||||||
|
@ -268,6 +268,7 @@ instance ShowRain A.Type where
|
||||||
showRainM (A.Mobile t) = showRainM t
|
showRainM (A.Mobile t) = showRainM t
|
||||||
showRainM (A.List t) = tell ["["] >> showRainM t >> tell ["]"]
|
showRainM (A.List t) = tell ["["] >> showRainM t >> tell ["]"]
|
||||||
showRainM A.Infer = tell ["(inferred type)"]
|
showRainM A.Infer = tell ["(inferred type)"]
|
||||||
|
showRainM (A.InferNum n) = tell ["(inferred numeric type: ",show n,")"]
|
||||||
showRainM x = tell ["<invalid Rain type: ", show x, ">"]
|
showRainM x = tell ["<invalid Rain type: ", show x, ">"]
|
||||||
|
|
||||||
instance ShowOccam A.DyadicOp where
|
instance ShowOccam A.DyadicOp where
|
||||||
|
|
|
@ -144,6 +144,9 @@ data Type =
|
||||||
| Mobile Type
|
| Mobile Type
|
||||||
-- | A type that will be inferred automatically by a pass.
|
-- | A type that will be inferred automatically by a pass.
|
||||||
| Infer
|
| Infer
|
||||||
|
-- | A numeric type to be inferred later, that must be able to hold the given
|
||||||
|
-- value
|
||||||
|
| InferNum Integer
|
||||||
deriving (Show, Eq, Typeable, Data)
|
deriving (Show, Eq, Typeable, Data)
|
||||||
|
|
||||||
-- | An array dimension.
|
-- | An array dimension.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user