improved interpreter and added support for doWhile

This commit is contained in:
weckyy702
2020-12-26 19:03:05 +01:00
parent e5f3f9a9d1
commit 0af259d3a0
4 changed files with 91 additions and 30 deletions

View File

@@ -130,13 +130,9 @@ class while_instruction_back(while_instruction_front):
while_instruction_front.__init__(self, condition, instructions)
def to_image(self, x:int, y:int, x_sz: int):
children_x, children_y, children_sz_x, children_sz_y = cti.draw_while_loop_back(self.instruction_text, x, y, x_sz, y_sz)
blk_size = self.draw_children(children_x, children_y, children_sz_x)
return x
def draw_children(self, x:float, y:float, x_sz:float):
for instruction in self.child_instructions:
x, y = instruction.to_image(x, y, x_sz)
children_x, children_y, children_sz_x = cti.draw_while_loop_back(self.instruction_text, x, y, x_sz, self.getblksize())
self.draw_children(children_x, children_y, children_sz_x)
return x, y + self.getblksize()
if __name__ == "__main__":