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.
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:
labelstatement.callstatement.retreturns execution to the point after the corresponding call.Motivation
This would let script authors reuse common script sections and structure larger programs without copy-pasting blocks of commands.