Skip to content

Lower core DEL HIR into canonical workshop-rs WIR #30

Description

@Teakowa

Parent: #8

Goal

Implement the first production lowering path from validated typed DEL HIR into workshop_rs::wir::Program for the core DEL/OSTW surface, using canonical Workshop identities and returning structured diagnostics for constructs whose runtime lowering is not yet implemented.

Context

The Workshop integration boundary is concrete: released workshop-rs 0.1.1 provides the canonical catalog/WIR contract, including the full reviewed rule-event surface from workshop-rs#12, and #29 establishes the direct dependency/catalog provider seam.

This issue should prove the HIR -> canonical WIR boundary before adding the more complex object/reference runtime encodings tracked separately.

Scope

  • Build canonical WIR file/source provenance from the DEL source registry.
  • Allocate global variables, player variables, and subroutines deterministically, honoring evidence-backed explicit source IDs/reservations where applicable.
  • Lower top-level initializers into correct Workshop initialization behavior without adding semantics to workshop-rs.
  • Lower core rules, conditions, actions, values, literals, arrays, canonical enum constants, external Workshop calls, assignments/modifications, and subroutine calls.
  • Lower supported control flow, including if, while, and direct Workshop for forms where the current HIR carries sufficient intent.
  • Lower the declared DEL rule-event inventory through the canonical event contract shipped in workshop-rs 0.1.1; do not introduce a local event representation.
  • Resolve Workshop calls/constants using canonical bindings produced by the catalog-backed provider from Establish the workshop-rs dependency and canonical catalog provider #29.
  • Validate every produced program through workshop_rs::wir::Program::validate and canonical Workshop validation where applicable.
  • Preserve DEL spans/provenance on WIR variables, rules, actions, and values wherever the public WIR model supports it.
  • Add focused positive/negative tests tying each supported lowering category to DEL corpus evidence and canonical WIR invariants.
  • Return stable structured lowering diagnostics for advanced/runtime/project constructs not yet supported; never silently drop or approximate them as successful compilation.

Non-goals

  • Class/object allocation, delete, stale-reference generation checks, virtual dispatch, recursion stacks, closure runtime encoding, or other advanced runtime layout decisions.
  • Duplicating catalog/WIR/emitter logic from workshop-rs.
  • Matching upstream helper names, variable layouts, formatting, optimizer output, or temporary variables unless observable semantics require them.
  • Full CLI/end-to-end compiler compatibility claim.

Acceptance criteria

  • Representative core DEL/OSTW programs lower from validated HIR to structurally valid canonical WIR.
  • Workshop actions/values/enums/events in produced WIR use canonical catalog identities, not localized or provider-specific spellings.
  • Global/player variable and subroutine identities are deterministic and evidence-backed.
  • Source provenance survives into WIR diagnostics for representative cross-file cases.
  • Unsupported advanced constructs fail explicitly with structured diagnostics rather than producing semantically incomplete WIR.
  • Existing Workshop-independent parse/check/inspect/HIR tests remain regression-green.

Dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestrustPull requests that update rust code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions