-
Notifications
You must be signed in to change notification settings - Fork 0
/
oaf_state.py
79 lines (63 loc) · 1.58 KB
/
oaf_state.py
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
# Module that keeps the state of the parser
# Current calling function
current_call = ""
#label stack
label_stack = []
# Assign list used for dimentional operations
assign_list = []
# Return values of functions
return_dir_stack = []
return_var_stack = []
func_parsing = False
# Array information, used when parsing arrays
arr_dim = [] # Used to get dimension size
arr_dim_str = "" # Used to update function signature in preparser
arr_current_dim = 0 # Used to access array and verify limits
arr_dim_stack = [] # Used for nested arrays
arr_m_list = [] # M values for each dimension
arr_r = 1 # R value
arr_indices = [] # List that holds the calculated indices
arr_parsing = False
# Unresolved variables
unresolved_vars = {}
# Operands stack
operand_stack = []
# Operator stack
operator_stack = []
last_operator = None
# Pointer counter
ptr_counter = 0
# Temp counter
temp_counter = 0
# Memory address (bytes)
global_dir = 0
constant_dir = 0
local_dir = 0
temp_dir = 0
stack_dir = 0
special_dir = 0
# Function signature
signature = []
# List of al the parameters
f_param_list = []
# Param counter
param_counter = 0
# Param types of function call
param_types = []
# Quad list
quads = []
# Offsets
g_offset = 0 # Global
c_offset = 0 # Constant
l_offset = 0 # Local
t_offset = 56000 # Temporal
def clear_stacks():
global operator_stack, operand_stack, last_operator
del(operator_stack[:])
del(operand_stack[:])
last_operator = None
def reset_call():
global param_counter, param_types, signature
param_counter = 0
param_types = []
signature = []