diff options
author | Camil Staps | 2017-07-20 20:25:25 +0000 |
---|---|---|
committer | Camil Staps | 2017-07-20 20:25:25 +0000 |
commit | bc950badd0655328af7a9886988722809e367d07 (patch) | |
tree | 6411d00c5022b591697c206cc1261dafb8ec8b33 /Sil/Types.dcl | |
parent | Add checks for locals with type Void (diff) |
Type checking
Diffstat (limited to 'Sil/Types.dcl')
-rw-r--r-- | Sil/Types.dcl | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Sil/Types.dcl b/Sil/Types.dcl new file mode 100644 index 0000000..1659436 --- /dev/null +++ b/Sil/Types.dcl @@ -0,0 +1,36 @@ +definition module Sil.Types + +from StdOverloaded import class ==, class toString + +from Data.Error import :: MaybeError +from Data.Maybe import :: Maybe + +from Sil.Syntax import :: Expression, :: Function, :: Name, :: Op1, :: Op2 + +:: Type + = TBool + | TInt + | TVoid + | (-->) infixr Type Type + +:: TypeError + = IllegalApplication Type Type + +instance == Type + +instance toString Type +instance toString TypeError + +/** + * Size of an expression on the stack + */ +typeSize :: Type -> Int + +:: TypeResolver :== Name -> Maybe (MaybeError TypeError Type) + +class type a :: TypeResolver a -> Maybe (MaybeError TypeError Type) +instance type Function +instance type Expression +instance type Name +instance type Op1 +instance type Op2 |