prometeu-studio/docs/pbs/agendas/13. IR and Lowering Agenda.md

123 lines
4.0 KiB
Markdown

# PBS Frontend IR and Lowering Agenda
Status: Active
## Purpose
Drive closure of `13. Lowering IRBackend Specification.md` for frontend scope only.
This agenda exists to define the first normative lowering boundary:
- PBS source to frontend IR (`IRBackend` / `IRBackendFile`),
- deterministic diagnostic behavior for unsupported or invalid source forms,
- and test-backed acceptance criteria for Gate U.
## Scope Boundary
In scope:
- lexer/parser/AST/linking outputs consumed by frontend lowering,
- semantic facts that must be preserved in frontend IR,
- deterministic rejection classes and diagnostic attribution,
- and conformance evidence for frontend gates.
Out of scope:
- VM lowering,
- bytecode/PBX mapping,
- runtime execution behavior,
- verifier/loader algorithms.
## Decisions To Produce
1. Decide whether `13` standardizes one frontend IR shape or only preserved obligations.
2. Decide the minimum preconditions before frontend lowering begins.
3. Decide which semantic facts must be explicit in frontend IR for v1.
4. Decide the minimum deterministic rejection set for unsupported frontend-lowering cases.
5. Decide the gate evidence expected from tests (`lexer/parser/AST/IRBackend/diagnostics`).
## Core Questions
1. What is the minimum frontend IR contract that keeps implementation practical and testable now?
2. Which source-observable guarantees must already be explicit before any backend stage exists?
3. Which constructs are in-scope for v1 lowering and which must fail deterministically?
4. What diagnostics identity must be stable for lowering-related frontend failures?
5. Which regression fixtures become mandatory Gate U evidence?
## Proposed Workshop Sequence
### Workshop 1: Frontend Lowering Contract and Preconditions
Purpose:
- close input preconditions,
- and close the normative status of frontend IR.
Expected decisions:
- obligations-only versus canonical frontend IR model,
- and minimum required bound-program state before lowering.
### Workshop 2: Expressions, Control Flow, and Propagation in Frontend IR
Purpose:
- close frontend-lowering obligations for core expression/control-flow forms.
Expected decisions:
- once-only evaluation obligations in frontend IR terms,
- representation obligations for branching and propagation constructs.
### Workshop 3: Callable Categories in Frontend IR
Purpose:
- close frontend-lowering obligations for functions, callbacks, services, and contracts as source-level categories.
Expected decisions:
- minimum callable metadata preserved in frontend IR,
- and deterministic rejection boundaries for unsupported callable forms.
### Workshop 4: Builtins, Diagnostics, and Test Gates
Purpose:
- close builtin-facing frontend obligations plus gate-ready diagnostics/test evidence.
Expected decisions:
- frontend treatment of builtin shells/metadata at lowering boundary,
- minimum diagnostics identity and attribution for lowering-related failures,
- and required fixture families for Gate U.
## Expected Spec Material
The resulting `13` content should close:
- lowering preconditions for frontend scope,
- frontend IR preserved-obligation model,
- construct-by-construct frontend lowering baseline,
- deterministic unsupported-case rejection policy,
- and frontend-facing diagnostic/test evidence hooks.
## Non-Goals
- Defining VM or bytecode artifacts.
- Freezing runtime semantics in this agenda.
- Defining verifier or loader internals.
- Freezing optimizer architecture.
## Inputs
- `docs/pbs/specs/3. Core Syntax Specification.md`
- `docs/pbs/specs/4. Static Semantics Specification.md`
- `docs/pbs/specs/9. Dynamic Semantics Specification.md`
- `docs/pbs/specs/10. Memory and Lifetime Specification.md`
- `docs/pbs/specs/12. Diagnostics Specification.md`
- `docs/pbs/specs/13. Lowering IRBackend Specification.md`
- `docs/general/specs/13. Conformance Test Specification.md`
- `docs/general/specs/14. Name Resolution and Module Linking Specification.md`
- `docs/general/specs/19. Verification and Safety Checks Specification.md`