prometeu-studio/docs/pbs/agendas/archive/11.3. AST Workshop 3 - Statements and Expressions.md

2.6 KiB

PBS AST Workshop 3

Status: Closed (2026-03-05)

Purpose

Close AST obligations for statement and expression surfaces, including precedence/associativity representation and unsupported-form boundaries.

Decisions To Produce

  1. Mandatory statement/expression node families for v1 AST.
  2. Representation obligations for precedence and associativity outcomes.
  3. Deterministic rejection policy for unsupported statement/expression forms.
  4. Minimum node consistency rules used by diagnostics and lowering.

Candidate Decisions

1. Parsing Outcomes Must Be Visible in AST Shape

  • Precedence and associativity results are reflected by explicit tree shape.
  • No hidden post-parse rewrites that change source-observable meaning.

2. Unsupported Forms Are Deterministic Reject

  • Forms outside supported syntax/lowering slice must fail with stable diagnostics.
  • They must not collapse into permissive placeholder AST nodes.

3. AST Consistency for Downstream Use

  • Statement/expression nodes needed by static semantics and lowering must always carry coherent spans and child structure.

Questions To Resolve

  1. Which expression forms are mandatory in v1 AST conformance?
  2. Which recoveries are acceptable without masking parse errors?
  3. What exact AST checks should Gate U fixtures assert?

Expected Outputs

  1. Decision note on statement/expression AST model.
  2. Decision note on unsupported-form policy.
  3. Fixture targets for precedence/associativity and rejection cases.

Decision Outcome (2026-03-05)

Decision record: docs/pbs/decisions/AST Statements and Expressions Decision.md.

  1. Mandatory statement/expression node families cover the supported v1 PBS syntax slice, including block, let, return, expression statement, identifier, literals, unary, binary, call, and group.
  2. Precedence and associativity outcomes are normative via AST shape.
  3. Non-associative/forbidden chained forms are deterministic reject with stable diagnostics.
  4. AST remains structural; semantic compatibility/type rules stay in static semantics/linking.
  5. Unsupported forms are deterministic reject and cannot be masked by permissive placeholder nodes.
  6. Recovery is allowed, but recovered AST must remain structurally coherent with stable attribution.
  7. Gate U evidence requires positive/negative fixtures with AST-shape and diagnostics assertions.

Inputs

  • docs/pbs/specs/3. Core Syntax Specification.md
  • docs/pbs/specs/11. AST Specification.md
  • docs/pbs/specs/12. Diagnostics Specification.md
  • docs/pbs/specs/13. Lowering IRBackend Specification.md
  • docs/pbs/agendas/archive/11.2. AST Workshop 2 - Declarations and Type Surfaces.md