Parent: #1
Goal
Make OPY semantic lowering discoverable by giving distinct source-language responsibilities explicit local module ownership instead of continuing to accumulate them in one phase implementation.
Context
opy-rs owns OverPy semantic resolution, HIR, and OPY-specific lowering. The current lowering path has grown to combine symbol/declaration collection, scope and lowering state, rule/statement/expression lowering, builtin/member compatibility resolution, custom enum behavior, macros, and special source forms behind one Lowerer implementation.
The current language-core contract requires source-language behavior to have a discoverable semantic home and treats phase modules such as the lowerer as infrastructure boundaries rather than default homes for unrelated policy. The problem here is responsibility locality and navigability, not the size of a Rust file by itself.
Scope
- Establish explicit internal module ownership for the stable semantic responsibilities currently concentrated in the lowering implementation.
- Keep shared lowering state centralized where it is genuinely shared, while moving feature/domain behavior behind cohesive local boundaries.
- Keep OPY-specific semantic decisions implemented directly in typed Rust.
- Keep declarative manifests/inventories limited to mechanical identities, signatures, provenance, and other data that does not itself program source-language behavior.
- Preserve structured diagnostics, source provenance, HIR contracts, and the existing Workshop ownership boundary.
- Keep the public lowering entry points stable unless a concrete consumer contract requires a separately reviewed API change.
Non-goals
- Changing accepted/rejected OPY behavior or compiler semantics.
- Rewriting the parser, preprocessor, HIR, or compiler architecture.
- Introducing a generic visitor/framework, service/container hierarchy, per-feature class hierarchy, or new dependency solely to organize code.
- Moving canonical Workshop semantics into
opy-rs.
- Converting bulk declarative inventories into handwritten Rust when they are already appropriately data-driven.
- Mechanical file-size, line-count, module-count, or abstraction targets.
- Unrelated cleanup outside semantic lowering.
Acceptance criteria
- Declaration/symbol handling, statement/control-flow lowering, expression/builtin/member resolution, and special-form semantics have discoverable internal ownership rather than requiring navigation through one monolithic phase implementation.
- A new or changed OPY semantic feature can be placed with its owning behavior without extending an unrelated generic phase bucket.
- Shared state remains no broader than required by the existing lowering contract; no new global/interior-mutable coordination mechanism is introduced for organization alone.
- Public check/HIR/lowering behavior and structured diagnostics remain compatible within the declared surface.
- Existing affected compatibility, corpus, and real-project regression evidence remains green without weakening expectations or redefining oracle behavior.
- No new manifest field or registry mechanism is introduced to move typed semantic decisions into data.
Parent: #1
Goal
Make OPY semantic lowering discoverable by giving distinct source-language responsibilities explicit local module ownership instead of continuing to accumulate them in one phase implementation.
Context
opy-rsowns OverPy semantic resolution, HIR, and OPY-specific lowering. The current lowering path has grown to combine symbol/declaration collection, scope and lowering state, rule/statement/expression lowering, builtin/member compatibility resolution, custom enum behavior, macros, and special source forms behind oneLowererimplementation.The current language-core contract requires source-language behavior to have a discoverable semantic home and treats phase modules such as the lowerer as infrastructure boundaries rather than default homes for unrelated policy. The problem here is responsibility locality and navigability, not the size of a Rust file by itself.
Scope
Non-goals
opy-rs.Acceptance criteria