Skip to content

Feature: add labels and subroutine calls #5

@nholthaus

Description

@nholthaus

Problem

Scripts currently execute top to bottom with loops as the only built-in control-flow structure. There is no way to define reusable script sections and jump to them, which makes larger scripts repetitive and hard to organize.

Specification

Add support for labeled subroutines in script files.

Acceptance criteria:

  • Scripts can define a named jump target with a label statement.
  • Scripts can transfer control to that target with a call statement.
  • ret returns execution to the point after the corresponding call.
  • Unknown labels and duplicate label definitions fail with a clear error message.
  • Nested or repeated calls behave predictably without corrupting execution state.

Motivation

This would let script authors reuse common script sections and structure larger programs without copy-pasting blocks of commands.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions