aboutsummaryrefslogtreecommitdiff
path: root/Sil/Types.dcl
blob: 51d4229355651b6350431850e3c0e51ade278297 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
definition module Sil.Types

from StdOverloaded import class ==, class +, class toString, class zero

from Data.Error import :: MaybeError
from Data.Maybe import :: Maybe

from ABC.Assembler import :: BasicType

from Sil.Error import :: Error
from Sil.Syntax import :: Expression, :: Function, :: Name, :: Op1, :: Op2

:: Type
	= TBool
	| TInt
	| TVoid
	| (-->) infixr Type Type
	| TTuple Int [Type]

:: TypeSize =
	{ asize  :: Int
	, bsize  :: Int
	, btypes :: [BasicType]
	}

instance == Type

instance toString Type

instance zero TypeSize

/**
 * Size of an expression on the stack
 */
typeSize :: Type -> TypeSize

(+~) infixl 6 :: TypeSize TypeSize -> TypeSize
(-~) infixl 6 :: TypeSize TypeSize -> TypeSize

:: TypeResolver :== Name -> Maybe (MaybeError Error Type)

instance zero TypeResolver

class type a :: TypeResolver a -> Maybe (MaybeError Error Type)
instance type Function
instance type Expression
instance type Name
instance type Op1
instance type Op2