0%

Parser: let? adjacency composition + fallible_pattern

Goal

Compose let + ADJACENT ? at parser level (the as? mechanism) with a normative no-interior-space adjacency check for BOTH let? and as? (fixes the as ? divergence folded into BUG-01-017). let? admitted in block-statement position only. fallible_pattern = match_pattern parameterized with $ at binding positions (standalone, element, list rest [optional identifier, anonymous rest stays legal], at-binder); const_pattern range endpoints unchanged.

Implementation Sketch

Scope contract: the approved proposal (compiler_repo/docs/ori_lang/proposals/approved/fallible-let-binding-proposal.md) - Design + Semantics + Spec & Grammar Impact sections govern this section verbatim; no scope invention. TDD: the failing test matrix for this section’s shapes lands before implementation; debug AND release verified at close.

Spec References

  • compiler_repo/docs/ori_lang/proposals/approved/fallible-let-binding-proposal.md
  • compiler_repo/docs/ori_lang/v2026/spec/16-control-flow.md (16.0.3, 16.5, 16.6, 16.7)
  • compiler_repo/docs/ori_lang/v2026/spec/15-patterns.md; 13-variables.md; grammar.ebnf

Work Items

  • Parse let? via let-keyword + adjacent-Question composition, block-statement position only; reject let ? with a spacing diagnostic
  • Parse fallible_pattern as parameterized match_pattern with $ at binding positions (incl. optional list-rest identifier and at-binder)
  • Fix as? adjacency: reject as ? with the same spacing diagnostic (BUG-01-017 fold); positive + negative parser tests for both forms