{- Data type annotations. These are enough to represent C primitives, stuctures and pointers/arrays. -} module Type (Type(..), TypeName(..), TypeDim(..), typed ) where data TypeName = AReal | AInt | ABool -- atomic deriving (Eq,Show) data Type = Type TypeName TypeDim TypeTemp deriving (Eq,Show) -- "Type" is interpreted liberally as "static property of code". -- Variables and primitive operations are typed as grid values, named -- relative to the (static) loop nesting context. Here 0=inner, -- 1=next, etc.. type TypeDim = Int type TypeTemp = Bool {- instance Show TypeName where show AFloat = "float" show AInt = "int" show ABool = "bool" show AVoid = "void" -- only used in C show (AStruct ts) = "struct " ++ show ts -} typed t v o = (showOrder o) ++ (show t) ++ "." ++ v showAs as = concat $ map (" " ++) $ map show as showOrder 0 = "" showOrder n = "*" ++ (showOrder $ n - 1)