-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptimizer_stuff.py
More file actions
38 lines (27 loc) · 1.17 KB
/
optimizer_stuff.py
File metadata and controls
38 lines (27 loc) · 1.17 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
import language
class SpecialCommand(language.Command):
def __init__(self, variable):
self.variable = variable
def __str__(self):
return "SPECIAL COMMAND: " + str(self.variable)
def print_out(self, indendation=0):
print(" " * indendation + str(self))
class VariableToRegisterStart(SpecialCommand):
"""When seen, assign register to a variable. It should not be used at all
before that command is seen."""
def __str__(self):
return "VARIABLE TO REGISTER START: " + str(self.variable)
class VariableToRegister(SpecialCommand):
"""When seen, assign register to a variable, and load it from memory."""
def __str__(self):
return "VARIABLE TO REGISTER: " + str(self.variable)
class RegisterToVariable(SpecialCommand):
"""When seen, disassociate register from a variable, and save that variable
to memory."""
def __str__(self):
return "VARIABLE TO MEMORY: " + str(self.variable)
class DeleteRegister(SpecialCommand):
"""When seen, eliminate data about variable from register, and don't save
it to memory."""
def __str__(self):
return "VARIABLE TO MEMORY OVER: " + str(self.variable)