doing a bit of cleaning up

This commit is contained in:
SpookyDervish
2025-09-07 20:00:35 +10:00
parent 35ee183768
commit be2cfdf9c8
4 changed files with 59 additions and 123 deletions

View File

@@ -1,5 +1,6 @@
from ground_ast import RootNode
from typing import Any
from ground_ast import *
class Generator:
@@ -21,6 +22,12 @@ class Generator:
self.constants_reverse[value] = "LC" + str(self.constant_counter)
self.constant_counter += 1
return "[.LC" + str(self.constant_counter-1) + "]"
def clamp_instruction_args(self, instruction: InstructionNode, min_args: int, max_args: int):
if len(instruction.arguments) < min_args:
traceback(self.code, "TypeError", f"{instruction.instruction} expects at least {min_args} arguments.")
elif len(instruction.arguments) > max_args:
traceback(self.code, "TypeError", f"{instruction.instruction} expects at most {max_args} arguments.")
def init(self):
pass