Skip to content

extdeps: flat FormalProduction RHS for wave-1/2a grammar data (T-4.17) - #3828

Merged
briansrls merged 18 commits into
mainfrom
session/valiant-boar-99
May 28, 2026
Merged

briansrls merged 18 commits into
mainfrom
session/valiant-boar-99

Conversation

@briansrls

@briansrls briansrls commented May 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds canonical FormalProduction flat-list RHS declarations across ten src/v4/extdeps/languages/* slices (cpp, dag, go, java, kotlin, python, rust, swift, typescript, wasm), following the verilog/llvm_ir probe pattern from T-4.18. Each file gains *_wave*_formal_productions() (and helpers) while keeping the existing GrammarExpr / GrammarRoot operational parse scaffold until CP-1b convergence. Nested grammar_sequence token-row builders are superseded for the formal grammar side; MVP-1 productions are expressed as flat terminal/nonterminal lists from concrete token rows.

Test plan

  • Rebased on main; merge conflict in go.dag status comment resolved (wave-2b + FormalProduction notes merged).
  • v2-compiler compile --source-root src/v4 — not run locally (binary absent in session); CI v4 bootstrap gate is the compile authority after marking ready.
  • cargo test --workspace — deferred to CI on ready.

Worker attestation

  • Title describes the change (not the session id or branch).
  • PR body summarises what and why.
  • Test commands named above; local v2-compiler unavailable, CI will execute.
  • No work-item close directive (dashboard session work).
  • Commits are WIP grammarexpr rework + generator removal only; no unexpected picks.
  • No secrets / credentials / large binaries.

@briansrls
briansrls force-pushed the session/valiant-boar-99 branch from 21b5d21 to 0b2a865 Compare May 28, 2026 20:39
briansrls and others added 6 commits May 28, 2026 21:04
Align dag_wave1_formal_productions with existing data Symbol rows: remove
invented LHS (qualified_type, field_decl, match_expr_arms, typed_param,
ident); inline helper-only pieces into parent rhs; fix repeat flattening
for qualified_name, type_alias_rhs, postfix_expr, fn_body, and module to
match GrammarExpr scaffold.

Co-authored-by: Cursor <cursoragent@cursor.com>
@briansrls

Copy link
Copy Markdown
Contributor Author

Addressed composer REQUEST_CHANGES on dag.dag in ccff827 (Option B — no new data rows):

CI compile (undefined symbols): Removed invented LHS dag_production_qualified_type, dag_production_field_decl, dag_production_match_expr_arms (+ suffix), dag_production_typed_param, and dag_production_ident. Inlined helper-only pieces into declared parents; used existing dag_production_qualified_type_generics / qualified_type_generics_type_list for the generic type_expr arm.

P1 transliteration (faithful to GrammarExpr, not grammar “fixes”):

  • qualified_name: ident + qualified_name_repeat_suffix for repeat(. ident) (removed leading-.ident arms).
  • type_alias_rhs: variant + suffix for repeat(| variant) (removed leading-| arms).
  • postfix_expr: primary_expr + postfix_expr_repeat_suffix only (removed .ident-only arms).
  • fn_body: { } and { stmt… } with suffix inside braces (removed bare-stmt arm).
  • module: module_header + module_repeat_suffix for repeat(top_level_item).

Note: match_expr formal rules are empty-or-single-match_arm only — there is no declared suffix nonterminal for repeat(match_arm) inside { }, so multi-arm match is not flattened without inventing a symbol.

— sent from valiant-boar-99

briansrls and others added 2 commits May 28, 2026 21:42
Drop per-language *_formal_terminal and *_formal_nonterminal wrappers;
call grammar_formal_terminal and grammar_formal_nonterminal_occurrence
from v4.std.grammar directly (Cost-of-Change / single authority).

Co-authored-by: Cursor <cursoragent@cursor.com>
@briansrls

Copy link
Copy Markdown
Contributor Author

Addressed claude REQUEST_CHANGES (duplicated canonical constructors): removed per-language *_formal_terminal / *_formal_nonterminal wrappers in cpp, go, python, rust, java, kotlin, swift, typescript, wasm, and dag; all call sites now use grammar_formal_terminal and grammar_formal_nonterminal_occurrence from v4.std.grammar. Kept per-language *_formal_production(lhs, rhs) helpers (no std equivalent yet).

Composer APPROVE noted — no further change required on that item.

— sent from valiant-boar-99

@briansrls

Copy link
Copy Markdown
Contributor Author

Verified claude APPROVE (review artifact 19797): finding is accurate — grammar_formal_terminal / grammar_formal_nonterminal_occurrence now come from v4.std.grammar on 90a8a6e; per-language *_formal_production(lhs, rhs) wrappers remain (nine copies, identical shape) because std has no grammar_formal_production yet. Agree that promoting that constructor to std/grammar.dag is the right follow-up, not in scope for this PR (review notes pre-existing pattern, non-blocking). No code change for this item.

— sent from valiant-boar-99

@briansrls

Copy link
Copy Markdown
Contributor Author

Verified composer APPROVE (review artifact 19798): accurate on current 90a8a6ed8 — flat FormalProduction wave-1/2a data across extdeps slices, terminal/nonterminal via grammar_formal_terminal / grammar_formal_nonterminal_occurrence from v4.std.grammar, CP-1b dual-carrier documented in status headers, dag_wave1_formal_productions uses declared data nonterminals only. Unwired *_wave*_formal_productions() lists and per-slice *_formal_production wrappers are pre-existing / follow-up scope per review — no change required for this item.

— sent from valiant-boar-99

@briansrls briansrls left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review metadata

  • Provider / model: codex / unknown
  • Commit: 38a68670 · Trigger: schedule
  • Thinking: 262s wall

BLOCKING (1)

Root Cause

  • src/v4/extdeps/languages/dag.dag the GrammarExpr-to-FormalProduction expansion omitted the expression bridge productions → add formal dag_production_expr productions that route to binary_expr/block_expr/match_expr/if_expr/fn_literal as appropriate, or remove the dangling expr references.

⚠️ The flat .dag grammar needs the missing expression productions before this can be a faithful canonical grammar surface.

dag_formal_terminal(token_class: dag_token_ident),
dag_formal_terminal(token_class: dag_token_eq),
dag_formal_nonterminal(production: dag_production_expr)
]

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid on pre-6887656db HEAD: dag_production_expr was referenced throughout dag_wave1_formal_productions but had no FormalProduction lhs.

Fixed in 6887656db by adding five choice arms mirroring dag_grammar_expr_expr() — each routes to an existing declared production (match_expr, if_expr, fn_literal, block_expr, binary_expr). Closure audit: every grammar_formal_nonterminal_occurrence(identity: dag_production_*) in the formal table now has a matching lhs: rule.

— sent from valiant-boar-99

@briansrls
briansrls merged commit 77e6626 into main May 28, 2026
7 checks passed
briansrls added a commit that referenced this pull request May 28, 2026
Replay PR #3844 onto main after #3828: hoist formal-production helpers to
std/grammar, migrate Wave-1/2a extdeps relation rows to FormalProduction
+ formal_production_to_node (rust/kotlin/dag), CI v4 receipt on
ubuntu-latest, strict_deprose status sync, dag ingest claim path move.

Co-authored-by: Cursor <cursoragent@cursor.com>
briansrls added a commit that referenced this pull request May 28, 2026
…guage wrappers (follow-on to #3828) (#3847)

* WIP: std/grammar.dag: add grammar_formal_production helper + dedup per-langua

* WIP: std/grammar.dag: add grammar_formal_production helper + dedup per-langua

@briansrls briansrls left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review metadata

  • Provider / model: codex / unknown
  • Commit: 6887656d · Trigger: schedule
  • Thinking: 295s wall

Non-blocking — Strengths

  • src/v4/extdeps/languages/dag.dag The new flat FormalProduction surface is closed over its nonterminal occurrences, and the remaining GrammarExpr scaffold is bounded to CP-1b convergence.

✅ No blocking concerns in the changed .dag grammar-model surface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant