support older python versions a bit more
This commit is contained in:
@@ -25,7 +25,7 @@ class X86_64Generator(Generator):
|
||||
|
||||
def get_variable(self, var_name: str, reg: str):
|
||||
self.push(
|
||||
f"QWORD [rsp + {(self.stack_size - self.variables.get(var_name)["stack_loc"] - 1) * 8}]"
|
||||
f"QWORD [rsp + {(self.stack_size - self.variables.get(var_name)['stack_loc'] - 1) * 8}]"
|
||||
)
|
||||
self.pop(reg)
|
||||
|
||||
|
14
out.asm
14
out.asm
@@ -1,15 +1,17 @@
|
||||
global _start
|
||||
|
||||
_start:
|
||||
; InstructionNode(instruction='set', parent=RootNode(statements=[..., InstructionNode(instruction='set', parent=..., arguments=[VariablePointer, Number]), InstructionNode(instruction='end', parent=..., arguments=[VariableReference])]), arguments=[VariablePointer, Number])
|
||||
mov rax, 6
|
||||
; InstructionNode(instruction='set', parent=RootNode(statements=[..., InstructionNode(instruction='set', parent=..., arguments=[VariablePointer, Number]), InstructionNode(instruction='add', parent=..., arguments=[VariableReference, Number, VariablePointer]), InstructionNode(instruction='end', parent=..., arguments=[VariableReference])]), arguments=[VariablePointer, Number])
|
||||
mov rax, 66
|
||||
push rax
|
||||
; InstructionNode(instruction='set', parent=RootNode(statements=[InstructionNode(instruction='set', parent=..., arguments=[VariablePointer, Number]), ..., InstructionNode(instruction='end', parent=..., arguments=[VariableReference])]), arguments=[VariablePointer, Number])
|
||||
mov rax, 7
|
||||
; InstructionNode(instruction='set', parent=RootNode(statements=[InstructionNode(instruction='set', parent=..., arguments=[VariablePointer, Number]), ..., InstructionNode(instruction='add', parent=..., arguments=[VariableReference, Number, VariablePointer]), InstructionNode(instruction='end', parent=..., arguments=[VariableReference])]), arguments=[VariablePointer, Number])
|
||||
mov rax, 69
|
||||
push rax
|
||||
; InstructionNode(instruction='end', parent=RootNode(statements=[InstructionNode(instruction='set', parent=..., arguments=[VariablePointer, Number]), InstructionNode(instruction='set', parent=..., arguments=[VariablePointer, Number]), ...]), arguments=[VariableReference])
|
||||
; InstructionNode(instruction='add', parent=RootNode(statements=[InstructionNode(instruction='set', parent=..., arguments=[VariablePointer, Number]), InstructionNode(instruction='set', parent=..., arguments=[VariablePointer, Number]), ..., InstructionNode(instruction='end', parent=..., arguments=[VariableReference])]), arguments=[VariableReference, Number, VariablePointer])
|
||||
; FUCK
|
||||
; InstructionNode(instruction='end', parent=RootNode(statements=[InstructionNode(instruction='set', parent=..., arguments=[VariablePointer, Number]), InstructionNode(instruction='set', parent=..., arguments=[VariablePointer, Number]), InstructionNode(instruction='add', parent=..., arguments=[VariableReference, Number, VariablePointer]), ...]), arguments=[VariableReference])
|
||||
mov rax, 60
|
||||
push QWORD [rsp + 0]
|
||||
push QWORD [rsp + 8]
|
||||
pop rdi
|
||||
syscall
|
||||
|
@@ -1,3 +1,4 @@
|
||||
set &x 6
|
||||
set &y 7
|
||||
end $y
|
||||
set &x 66
|
||||
set &y 69
|
||||
add $x 1 &x
|
||||
end $x
|
Reference in New Issue
Block a user