-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSymbol.mli
More file actions
85 lines (69 loc) · 3.49 KB
/
Symbol.mli
File metadata and controls
85 lines (69 loc) · 3.49 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
(* Symbol table *)
type pass_mode = PASS_BY_VALUE | PASS_BY_REFERENCE | PASS_RET
type global_status = GLOBAL_DEFINED | GLOBAL_USED
type param_status =
| PARDEF_COMPLETE (* ÐëÞñçò ïñéóìüò *)
| PARDEF_DEFINE (* Åí ìÝóù ïñéóìïý *)
| PARDEF_CHECK (* Åí ìÝóù åëÝã÷ïõ *)
type scope = {
sco_parent : scope option;
mutable sco_nesting : int;
mutable sco_entries : entry list;
mutable sco_negofs : int;
sco_ret_type : Types.typ;
}
and variable_info = { (******* ÌåôáâëçôÞ *******)
variable_type : Types.typ; (* Ôýðïò *)
variable_offset : int (* Offset óôï Å.Ä. *)
}
and function_info = { (******* ÓõíÜñôçóç *******)
mutable function_isForward : bool; (* ÄÞëùóç forward *)
mutable function_paramlist : entry list; (* Ëßóôá ðáñáìÝôñùí *)
mutable function_redeflist : entry list; (* Ëßóôá ðáñáìÝôñùí (2ç) *)
mutable function_result : Types.typ; (* Ôýðïò áðïôåëÝóìáôïò *)
mutable function_pstatus : param_status; (* ÊáôÜóôáóç ðáñáìÝôñùí *)
mutable function_initquad : int; (* Áñ÷éêÞ ôåôñÜäá *)
mutable function_scope : scope option; (* Negative offsets *)
function_isLibrary : bool; (* If it is a Lib func *)
function_global : (entry, global_status) Hashtbl.t
(* Global Definitions *)
}
and parameter_info = { (****** ÐáñÜìåôñïò *******)
parameter_type : Types.typ; (* Ôýðïò *)
mutable parameter_offset : int; (* Offset óôï Å.Ä. *)
parameter_mode : pass_mode (* Ôñüðïò ðåñÜóìáôïò *)
}
and temporary_info = { (** ÐñïóùñéíÞ ìåôáâëçôÞ **)
temporary_type : Types.typ; (* Ôýðïò *)
mutable temporary_offset : int (* Offset óôï Å.Ä. *)
}
and entry_info = ENTRY_none
| ENTRY_variable of variable_info
| ENTRY_function of function_info
| ENTRY_parameter of parameter_info
| ENTRY_temporary of temporary_info
and entry = {
entry_id : Identifier.id;
entry_scope : scope;
entry_info : entry_info
}
type lookup_type = LOOKUP_CURRENT_SCOPE | LOOKUP_ALL_SCOPES
val currentScope : scope ref (* ÔñÝ÷ïõóá åìâÝëåéá *)
val quadNext : int ref (* Áñéèìüò åðüìåíçò ôåôñÜäáò *)
val tempNumber : int ref (* Áñßèìçóç ôùí temporaries *)
val initSymbolTable : int -> unit
val openScope : Types.typ -> unit
val closeScope : entry -> unit
val newVariable : Identifier.id -> Types.typ -> bool -> entry
val newFunction : Identifier.id -> bool -> bool -> entry
val newParameter : Identifier.id -> Types.typ -> pass_mode ->
entry -> bool -> entry
val newTemporary : Types.typ -> entry
val forwardFunction : entry -> unit
val endFunctionHeader : entry -> Types.typ -> unit
val lookupEntry : Identifier.id -> lookup_type -> bool -> entry
val start_positive_offset : int (* Áñ÷éêü èåôéêü offset óôï Å.Ä. *)
val start_negative_offset : int (* Áñ÷éêü áñíçôéêü offset óôï Å.Ä. *)
val equalEntries : entry -> entry -> bool
val isLibraryFunction : entry -> bool
val find_first_temporary_offset : scope -> (int * entry list)