Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fancy langspec #76

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
idk it was here when i got here
barnjamin committed Mar 24, 2023
commit 4baed0ddaf548d60f5739e5e4523baa8c90a209b
4 changes: 2 additions & 2 deletions tealish/expression_nodes.py
Original file line number Diff line number Diff line change
@@ -214,10 +214,10 @@ def write_teal_user_defined_func_call(self, writer: "TealWriter") -> None:
def process_op_call(self, op: Op) -> None:
self.func_call_type = "op"
self.op = op
immediates = self.args[: op.immediate_args_num]
immediates = self.args[: len(op.immediate_args)]
num_args = len(op.args)

self.args = self.args[op.immediate_args_num :]
self.args = self.args[len(op.immediate_args):]
if len(self.args) != num_args:
raise CompileError(f"Expected {num_args} args for {op.name}!", node=self)
for i, arg in enumerate(self.args):
8 changes: 4 additions & 4 deletions tealish/langspec.py
Original file line number Diff line number Diff line change
@@ -119,7 +119,7 @@ class Op:
#: decoded list of incoming args
arg_types: List[AVMType]
#: list of arg types this op puts on the stack, encoded as a string
returns: List[str]
returns: List[str]
#: decoded list of outgoing args
returns_types: List[AVMType]
#: how many bytes this opcode takes up when assembled
@@ -188,13 +188,13 @@ def __init__(self, spec: Dict[str, Any]) -> None:
for name, st in cast(Dict[str, Any], spec["StackTypes"]).items()
}
# TODO: add pseudo ops to all ops
#self.pseudo_ops: Dict[str, Op] = {
# self.pseudo_ops: Dict[str, Op] = {
# op["Name"]: Op(op) for op in spec["PseudoOps"]
#}
# }

self.ops: Dict[str, Op] = {
op["Name"]: Op(op, self.stack_types) for op in spec["Ops"]
}
}

self.fields: Dict[str, FieldGroup] = {
name: FieldGroup(value)