stdin works i think

This commit is contained in:
SpookyDervish
2025-09-13 15:48:41 +10:00
parent 983e1e8a74
commit cc82d27b03
5 changed files with 90 additions and 2 deletions

View File

@@ -31,12 +31,15 @@ class Generator:
self.global_scope = SymbolTable()
self.current_var_scope = self.global_scope
self.constants = {}
self.buffers = {}
self.structs = {}
self.functions: dict[str, dict] = {}
self.labels = []
self.arg_list = []
self.constants_reverse = {}
self.constant_counter = 0
self.buffer_counter = 0
self.included_functions = []
def ground_type_to_node(self, ground_type: str):
if ground_type == "string":
@@ -58,6 +61,12 @@ class Generator:
self.constant_counter += 1
return "[LC" + str(self.constant_counter-1) + "]"
def add_buffer(self, size: int):
buffer_name = "BUF" + str(self.buffer_counter)
self.buffers[buffer_name] = size
self.buffer_counter += 1
return buffer_name
def add_function(self, node: FunctionNode):
self.functions[node.name] = {
"func": node,