split interpretation into two steps: Tokenization and Lexing

This commit is contained in:
weckyy702
2021-03-31 19:47:37 +02:00
parent 53534ee707
commit 49f3c84e60
5 changed files with 462 additions and 138 deletions

View File

@@ -8,8 +8,8 @@ from draw.Iinstruction import Iinstruction
class Function_scope(Iterable):
"""This class serves as a container for Instructions"""
def __init__(self, child_instructions: List[Iinstruction], name: str, return_type: str, args: List[str]) -> None:
self.contents = child_instructions
def __init__(self, name: str, return_type: str, args: List[str]) -> None:
self.contents = []
self.name = name
self.return_type = return_type
self.args = args
@@ -26,5 +26,11 @@ class Function_scope(Iterable):
w = max(w, inst.getblkwidth())
return int(w)
def _add_instruction(self, inst: Iinstruction):
self.contents.append(inst)
def _add_instructions(self, inst: List[Iinstruction]):
self.contents.extend(inst)
def __iter__(self):
return self.contents.__iter__()