Intent Phase 4 follow-up: align :foreign ordering semantics (parser/docs/tests)

t-737·WorkTask·
·
·
Created3 weeks ago·Updated3 weeks ago·pipeline runs →

Dependencies

Description

Edit

Resolve :foreign syntax ordering ambiguity and document/enforce it.

Current state:

  • :foreign parsing currently depends on declaration field order in practice.
  • Behavior is not clearly documented for combinations with ? and λ.

Required behavior: 1. Decide and enforce one grammar contract for τ declarations, including position of optional blocks (?, λ, :foreign). 2. Parser should either:

  • accept the documented permutations, OR
  • reject unsupported orderings with explicit parse errors.

3. Update LANG.md grammar and examples to match actual parser behavior. 4. Add parser tests for ordering permutations (including negative tests with expected failure).

Recommendation:

  • Prefer making order flexible if implementation complexity is modest, because agents may emit different orderings.
  • If keeping strict order, document it prominently.

Acceptance:

  • No surprise parse failures for documented forms.
  • Docs and parser behavior are fully aligned.

Timeline (1)