doing a bit of cleaning up
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user