Skip to content

Expose canonical Workshop action layout for relative Skip lowering #102

Description

@Teakowa

Goal

Expose a minimal workshop-rs-owned canonical action-layout capability so consumers can lower native Workshop relative Skip semantics without duplicating emitter expansion rules.

Context

wrightkit/opy-rs#61 lowers OverPy control-flow sugar such as switch and do ... while into native Workshop primitives. switch, case/default, do-while placement, fallthrough, break policy, and source-language labels remain entirely OPY-owned semantics.

The actual cross-repository gap is lower-level: workshop-rs WIR is structured (If, While, For, etc.), while native Workshop Skip(n) distances are measured in the emitted Workshop action stream. A single structured WIR node may emit multiple native actions/markers. opy-rs currently mirrors those expansion rules locally to compute distances, which duplicates Workshop-owned emitter/layout semantics and can drift when canonical emission changes.

This issue is therefore about canonical Workshop action layout only, not a generic control-flow target system.

Scope

  • Provide a source-language-neutral public way to determine the native Workshop action span/width produced by canonical WIR actions or action sequences.
  • Cover nested structured actions whose emission expands into multiple native Workshop actions, including If/Else/End, While, and For forms.
  • Ensure the layout query and canonical emitter share one authoritative expansion model rather than maintaining duplicate width tables inside workshop-rs.
  • Keep validation/error handling explicit for malformed or unsupported WIR.
  • Add focused tests proving layout results remain consistent with deterministic canonical emission.

Non-goals

  • No Switch, Case, Default, DoWhile, OPY/DEL label, goto, CFG, or source-language control-flow node in WIR.
  • No source-language fallthrough, break, continue, or placement semantics in workshop-rs.
  • No generic symbolic relocation/target system unless future independent consumers provide concrete evidence that action-span queries are insufficient.
  • No reproduction of OverPy/OSTW compiler internals or output-text identity.
  • No broad WIR redesign unrelated to native action layout.

Acceptance Criteria

  • A documented public workshop-rs contract can report canonical native Workshop action span/width for validated WIR actions/sequences.
  • Nested If, While, ForGlobalVariable, and ForPlayerVariable structures have executable coverage.
  • The contract and emitter derive layout from the same authoritative implementation/source of truth; there is no second manually synchronized emitter-width table.
  • Invalid WIR/layout requests fail explicitly.
  • opy-rs#61 can delete its local normalized_action_width() model and consume the released Workshop-owned capability while retaining all OPY-specific switch/do-while semantics locally.
  • No source-language-specific semantic ownership is introduced into workshop-rs.

Dependencies

  • Blocks the durable relative-Skip lowering path in wrightkit/opy-rs#61 / wrightkit/opy-rs#47.
  • Consumer flow: implement and test the authoritative contract here -> publish a workshop-rs release -> update opy-rs#61 to consume it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions