checksupport.dcl 5.23 KB
Newer Older
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
1
2
3
definition module checksupport

import StdEnv
4
import syntax, predef, containers
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
5
6
7
8
9
10

CS_NotChecked 	:== -1
NotFound		:== -1

cModuleScope	:== 0
cGlobalScope	:== 1
11
cRankTwoScope	:== 2
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
12

13
14
15
16
17
cStdArrayImportMissing	:== 1
cStdEnumImportMissing	:== 2
cNeedStdDynamic 		:== 4
cNeedStdGeneric			:== 8
cNeedStdStrictLists		:== 16
18

Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
19
20
21
22
::	Heaps =
	{	hp_var_heap			::!.VarHeap
	,	hp_expression_heap	::!.ExpressionHeap
	,	hp_type_heaps		::!.TypeHeaps
23
	,	hp_generic_heap		::!.GenericHeap
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
24
25
26
27
	}

::	ErrorAdmin = { ea_file :: !.File, ea_loc :: ![IdentPos], ea_ok :: !Bool }

28
29
::	CheckState = { cs_symbol_table :: !.SymbolTable, cs_predef_symbols :: !.PredefinedSymbols, cs_error :: !.ErrorAdmin,cs_x :: !CheckStateX }

30
::	CheckStateX = {x_needed_modules :: !BITVECT,x_main_dcl_module_n :: !Int, x_check_dynamic_types :: !Bool }
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
31

32
33
34
35
36
37
38
39
40
::	Group = { group_members :: ![Int] }

::	Component = { component_members :: !ComponentMembers }

::	ComponentMembers
	= ComponentMember !Int !ComponentMembers
	| GeneratedComponentMember !Int !FunctionInfoPtr !ComponentMembers
	| NoComponentMembers

Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
41
42
43
44
45
46
47
instance == STE_Kind

cTypeDefs				:== 0
cConstructorDefs		:== 1
cSelectorDefs			:== 2
cClassDefs				:== 3
cMemberDefs				:== 4
48
cGenericDefs			:== 5
49
50
51
52
cGenericCaseDefs		:== 6
cInstanceDefs			:== 7
cFunctionDefs			:== 8
cMacroDefs				:== 9
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
53

54
cConversionTableSize	:== 10
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
55
56
57
58
59
60
61
62
63

class Erroradmin state
where
	pushErrorAdmin :: !IdentPos *state -> *state
	setErrorAdmin :: !IdentPos *state -> *state
	popErrorAdmin  :: *state -> *state

instance Erroradmin ErrorAdmin, CheckState

64
newPosition :: !Ident !Position -> IdentPos 
65
stringPosition :: !String !Position -> StringPos
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
66
67

checkError :: !a !b !*ErrorAdmin -> *ErrorAdmin | <<< a & <<< b
68
	special a={#Char},b={#Char}; a=Ident,b={#Char}
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
69
checkWarning :: !a !b !*ErrorAdmin -> *ErrorAdmin | <<< a & <<< b
Martin Wierich's avatar
Martin Wierich committed
70
checkErrorWithIdentPos :: !IdentPos !a !*ErrorAdmin -> .ErrorAdmin | <<< a;
71
checkErrorWithPosition :: !Ident !Position !a !*ErrorAdmin -> .ErrorAdmin | <<< a;
72
73
checkStringErrorWithPosition :: !{#Char} !Position !a !*ErrorAdmin -> *ErrorAdmin | <<< a
	special a={#Char};
74
checkWarningWithPosition :: !Ident !Position !a !*ErrorAdmin -> .ErrorAdmin | <<< a;
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
75
76
77
78
79
80
81

class envLookUp a :: !a !(Env Ident .b) -> (!Bool,.b)

instance envLookUp TypeVar, AttributeVar, ATypeVar

class toIdent a :: !a -> Ident

82
instance toIdent ConsDef, (TypeDef a), ClassDef, MemberDef, FunDef, SelectorDef // , ClassInstance
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
83
84
85
instance toIdent SymbIdent, TypeSymbIdent, BoundVar, TypeVar, ATypeVar, Ident

instance toInt STE_Kind
86
instance <<< IdentPos, StringPos
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
87

88
89
90
91
92
93
::	ExpressionInfo =
	{	ef_type_defs		:: !.{# CheckedTypeDef}
	,	ef_selector_defs	:: !.{# SelectorDef}
	,	ef_cons_defs		:: !.{# ConsDef}
	,	ef_member_defs		:: !.{# MemberDef}
	,	ef_class_defs		:: !.{# ClassDef}
94
	,	ef_generic_defs		:: !.{# GenericDef}
95
	,	ef_modules			:: !.{# DclModule}
96
	,	ef_macro_defs		:: !.{#.{#FunDef}}
97
98
99
100
	,	ef_is_macro_fun		:: !Bool
	}

retrieveGlobalDefinition :: !SymbolTableEntry !STE_Kind !Index -> (!Index, !Index)
101

102
addLocalFunctionDefsToSymbolTable :: !Level !Index !Index !Bool !*{#FunDef} !*SymbolTable !*ErrorAdmin -> (!*{# FunDef}, !*SymbolTable, !*ErrorAdmin)
103
addLocalDclMacroDefsToSymbolTable :: !Level !Int !Index !Index !*{#*{#FunDef}} !*SymbolTable !*ErrorAdmin -> (!*{#*{#FunDef}}, !*SymbolTable, !*ErrorAdmin)
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
104
addDefToSymbolTable :: !Level !Index !Ident !STE_Kind !*SymbolTable !*ErrorAdmin -> (!* SymbolTable, !*ErrorAdmin)
105
addDeclarationsOfDclModToSymbolTable :: Int !{!Declaration} !{!Declaration} !*{#DclModule} !*CheckState -> (!*{#DclModule},!*CheckState)
106
addGlobalDefinitionsToSymbolTable :: ![Declaration] !*CheckState -> .CheckState;
107
108
addSymbol :: !(Optional a) !Ident !Position !STE_Kind !STE_Kind !.Int !.Int !Int !*{#DclModule} !*CheckState -> (!Bool,!*{#DclModule},!*CheckState)
addImportedFunctionOrMacro :: !(Optional IndexRange) !Ident !Int !*{#DclModule} !*CheckState -> (!Bool,!*{#DclModule},!.CheckState)
109

110
removeImportedSymbolsFromSymbolTable :: Declaration !*SymbolTable -> .SymbolTable
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
111
removeFieldFromSelectorDefinition :: !Ident .Int .Int !*(Heap SymbolTableEntry) -> .Heap SymbolTableEntry;
112
removeDeclarationsFromSymbolTable :: ![Declaration] !Int !*SymbolTable -> *SymbolTable
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
113
114
removeLocalIdentsFromSymbolTable :: .Int !.[Ident] !*(Heap SymbolTableEntry) -> .Heap SymbolTableEntry;
removeIdentFromSymbolTable :: !.Int !Ident !*(Heap SymbolTableEntry) -> .Heap SymbolTableEntry;
115
removeImportsAndLocalsOfModuleFromSymbolTable :: !Declarations !*(Heap SymbolTableEntry) -> .Heap SymbolTableEntry
116
117
removeLocalFunctionsFromSymbolTable :: !Level !IndexRange !*{# FunDef} !*(Heap SymbolTableEntry) -> (!.{# FunDef}, !.Heap SymbolTableEntry)
removeLocalDclMacrosFromSymbolTable :: !Level !Index !IndexRange !*{#*{#FunDef}} !*(Heap SymbolTableEntry) -> (!.{#.{#FunDef}}, !.Heap SymbolTableEntry)
118
119

newFreeVariable :: !FreeVar ![FreeVar] ->(!Bool, ![FreeVar])
120
121

local_declaration_for_import :: !u:Declaration .Index -> v:Declaration, [u <= v]
122
123
124
125
126

:: BelongingSymbols
	=	BS_Constructors ![DefinedSymbol]
	|	BS_Fields !{#FieldSymbol}
	|	BS_Members !{#DefinedSymbol}
127
	|	BS_MembersAndMacros !{#DefinedSymbol} !{#MacroMember} !{#Int} !{!MacroMember}
128
129
	|	BS_Nothing

Martin Wierich's avatar
Martin Wierich committed
130
getBelongingSymbols :: !Declaration !v:{#DclModule} -> (!BelongingSymbols, !v:{#DclModule})
131
132
133
nrOfBelongingSymbols :: !BelongingSymbols -> Int

import_ident :: Ident
134
restoreIdentsSymbolPtrs :: ![Ident] !*SymbolTable -> *SymbolTable