diff --git a/fco2/AST.hs b/fco2/AST.hs index 6853ccc..7ad16d2 100644 --- a/fco2/AST.hs +++ b/fco2/AST.hs @@ -49,7 +49,30 @@ data Type = | Any | Timer | Port Type - deriving (Show, Eq, Typeable, Data) + deriving (Eq, Typeable, Data) + +instance Show Type where + show Bool = "BOOL" + show Byte = "BYTE" + show Int = "INT" + show Int16 = "INT16" + show Int32 = "INT32" + show Int64 = "INT64" + show Real32 = "REAL32" + show Real64 = "REAL64" + show (Array ds t) + = concat [case d of + Dimension n -> "[" ++ show n ++ "]" + UnknownDimension -> "[]" + | d <- ds] ++ show t + show (UserDataType n) = nameName n ++ "{data type}" + show (Record n) = nameName n ++ "{record}" + show (UserProtocol n) = nameName n ++ "{protocol}" + show (Chan t) = "CHAN OF " ++ show t + show (Counted ct et) = show ct ++ "::" ++ show et + show Any = "ANY" + show Timer = "TIMER" + show (Port t) = "PORT OF " ++ show t data Dimension = Dimension Int diff --git a/fco2/TODO b/fco2/TODO index 17c242f..f00162f 100644 --- a/fco2/TODO +++ b/fco2/TODO @@ -10,8 +10,6 @@ that takes several expressions. (Multi-subscript expressions like a[x][y] currently get pulled up into an array slice, which is inefficient.) -The show instance for types should produce occam-looking types. - ParseState should be called something more sensible, since most of it has nothing to do with parsing.