Skip to content

inst defintion and its optional stack_effect #133412

Closed
@nybblista

Description

@nybblista

The DSL specification syntax definition of the inst shows that the stack_effect is optional,
including its parentheses:

definition:
    "inst" "(" NAME ["," stack_effect] ")" "{" C-code "}"
...
stack_effect:
    "(" [inputs] "--" [outputs] ")"

But if we defined a new instruction, let's say, MY_INSTRUCTION as:

inst(MY_INSTRUCTION) {
  /* implementation */
}

We will get the following error:

SyntaxError: Extra stuff at the end of ./Python/bytecodes.c

However, if we defined MY_INSTRUCTION with an empty stack-effect, it will work!

inst(MY_INSTRUCTION, ( -- )) {
  /* implementation */
}

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc direasy

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions