Skip to content

execution: add recursive control jump between processes and routines#151

Open
Dev10-sys wants to merge 1 commit intosugarlabs:developfrom
Dev10-sys:feat/recursive-routine-control-jump-clean
Open

execution: add recursive control jump between processes and routines#151
Dev10-sys wants to merge 1 commit intosugarlabs:developfrom
Dev10-sys:feat/recursive-routine-control-jump-clean

Conversation

@Dev10-sys
Copy link

Overview

Adds recursive control jump support between processes and routines.

The parser now maintains a call frame stack model that enables:

  • Routine invocation from within processes
  • Nested routine calls
  • Deterministic frame restoration
  • Process-level execution isolation

Implementation Details

  • Introduced IPCRoutineCall as a structured program counter override signal.
  • Extended TPCOverride to support routine invocation.
  • Added callFrames stack to parser state (TProgramMapEntry).
  • Implemented frame preservation and restoration logic in getNextElement.
  • Added interpreter wrapper invokeRoutine.
  • Added test coverage for:
    • Single routine call
    • Nested routine calls
    • Multi-process isolation
    • Stack trace validation

Design Model

Execution flow:

Process
└─ box-boolean
└─ invoke Routine A
└─ Routine A
└─ invoke Routine B
└─ Routine B
└─ return
└─ return
└─ continue process

The call frame stack ensures:

  • Frames are preserved at invocation
  • Return node is restored correctly
  • No frame leakage between processes
  • No override bleeding into subsequent instructions

Testing

  • All existing tests pass
  • New tests validate recursive invocation behavior
  • TypeScript check clean

Related Issue

Closes #137

…odel

- introduce IPCRoutineCall override signal
- add call frame stack to parser state
- support nested routine invocation
- ensure process isolation
- add tests for single, nested and multi-process cases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for recursive control jump between processes and routines

1 participant