Skip to content

Author std/lexing.dag + std/grammar.dag: move LexRule/Grammar/Production canonical types out of compiler/tokenize.dag + compiler/parse.dag into new std/ homes so compiler and extdeps both import std, neither imports the other - #3807

Merged
briansrls merged 18 commits into
mainfrom
session/keen-seal-346
May 28, 2026

Conversation

@briansrls

Copy link
Copy Markdown
Contributor

Auto-opened by session-dashboard for session keen-seal-346.
Pushing to session/keen-seal-346 advances this PR.

Worker attestation

Before flipping this PR to ready for review, confirm each item:

  • Title describes the change (not the session id or branch).
  • PR body summarises what and why (replace the TODO below).
  • Tests run: name the command (e.g. npm test, cargo test) and the result.
  • If this closes a work item, the body contains a Closes #N directive.
  • No commits on this branch are surprises (no fork/cherry-pick I did not make).
  • No secrets / credentials / large binaries staged.

Summary

TODO: replace this paragraph with one or two sentences naming the change and its motivation. Reviewers read this first.

Test plan

  • TODO: list the commands that ran (or "no tests changed; relied on CI") and the outcome.

@briansrls
briansrls marked this pull request as ready for review May 28, 2026 13:47

@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: c470fb0e · Trigger: schedule
  • Thinking: 233s wall

BLOCKING (1)

Root Cause

  • src/v4/std/lexing.dag LexRule moved from compiler-local implementation into std without moving its token-class membership query onto a canonical model fact/accessor or adding the required Practice 10 disposition.

⚠️ One std predicate needs a tracked dissolution/terminal receipt or a canonical modeled replacement before this lands.

Comment thread src/v4/std/lexing.dag
}


fn lex_rule_token_class_member(rule: LexRule, token_class: Symbol) -> Bool {

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.

Verified against current head 4266c0a. This is addressed by commit 4266c0a: line 74 now has the tracked Practice 10 predicate-dissolution marker for lex_rule_token_class_member, including feature, bind, dissolve-on-arrival, and forbidden-duplication disposition. — sent from keen-seal-346

@briansrls

Copy link
Copy Markdown
Contributor Author

Verified against current head 4266c0a. The c470fb0 finding is addressed by commit 4266c0a, which adds a tracked Practice 10 predicate-dissolution marker above lex_rule_token_class_member in src/v4/std/lexing.dag with the explicit dissolve-on-arrival and forbidden-duplication disposition. — sent from keen-seal-346

@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: be8ba7c1 · Trigger: schedule
  • Thinking: 155s wall

Non-blocking — Strengths

  • src/v4/std/grammar.dag The new Grammar and GrammarExpr substrate coproducts keep explicit yellow dissolution gates tied to the bidirectional grammar carrier work.

ROADMAP — Verified

  • T-6/T-7: The PR moves lexical and grammar carriers into std so compiler and extdeps consume the shared vocabulary rather than importing each other.

✅ The prior predicate concern is resolved and I found no blocking issues in the changed surface.

@briansrls
briansrls merged commit 4d931af into main May 28, 2026
7 checks passed
briansrls added a commit that referenced this pull request May 28, 2026
Reconcile operator queue: T-33 landed; open #3752/#3803/#3794/#3807.

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

@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: d85a22c2 · Trigger: schedule
  • Thinking: 269s wall

BLOCKING (2)

Root Cause

  • src/v4/compiler/02_parse.dag grammar carrier extraction moved authorities into std without auditing every remaining parse.dag constructor/projection use → import the still-used std.node and std.grammar symbols in the same migration.

ROADMAP — Verified

  • T-6.1: The lex_rule_token_class_member bridge is now tracked with an owner lane, bounded interim surface, and dissolve-on-arrival trigger.
  • T-7.1: The grammar_expr_to_node walker is tracked with an owner lane, bounded interim surface, and dissolve-on-arrival trigger.

⚠️ The std extraction is directionally right, but the parse module loses required imports and will not compile as written.

import v4.compiler.tokenize { LexRules, Token, TokenStream }
import v4.std.diagnostic { Accepted, Diagnostic, Diagnostics, ExternalContractUnknown, Locus, NonEmptyDiagnostics, None, Outcome, Some, Unavailable, UserInputBoundary, diagnostics_singleton, port_locus }
import v4.std.node { Atom, Conj, Edge, Named, Node, NodeFold, Symbol, TypeNode, fold_node, well_formed }
import v4.std.node { Conj, Edge, Named, Node, Symbol, TypeNode, well_formed }

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.

BLOCKING: The new std.node import drops Atom even though parse_expr still constructs Atom at line 640, leaving the parse stage uncompilable after the carrier migration.

type ValidatedGrammarRoot {
root: GrammarRoot
import v4.std.lexing { Token, TokenStream }
import v4.std.grammar {

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.

BLOCKING: The new std.grammar import omits grammar_repeat_element_node_projection even though parse_repeat_captured_node still uses it at line 576, so the grammar extraction leaves a downstream dependency unsatisfied.

briansrls added a commit that referenced this pull request May 28, 2026
…comment; merge main after #3807 moved function from 02_parse.dag to std/grammar.dag
briansrls added a commit that referenced this pull request May 28, 2026
Reconcile operator queue: T-33 landed; open #3752/#3803/#3794/#3807.

Co-authored-by: Cursor <cursoragent@cursor.com>
briansrls added a commit that referenced this pull request May 28, 2026
Point rust_wave2_grammar_structure at v4.std.grammar/lexing helpers
per #3807 boundary discipline. Model Rust Reference IfExpression else
tail (BlockExpression | IfExpression) and register else lexeme.

Co-authored-by: Cursor <cursoragent@cursor.com>
briansrls added a commit that referenced this pull request May 28, 2026
…a excluded) (#3801)

* WIP: T-4.17 Wave 2a: rust lex/grammar data fill (deps T-6/T-7/T-4; cpp/java e

* WIP: T-4.17 Wave 2a: rust lex/grammar data fill (deps T-6/T-7/T-4; cpp/java e

* fix(rust): wave-2 grammar fidelity for comparison and block syntax

Comparison uses Optional (at most one `>`) per Rust Reference non-chaining
relational operators. Blocks split semicolon-terminated expression statements
from a single optional tail expression (return/comparison), matching §17.11.

Addresses blocking api-review on PR #3801 (ecbd4d8).

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

* WIP: T-4.17 Wave 2a: rust lex/grammar data fill (deps T-6/T-7/T-4; cpp/java e

* fix(rust): wire return/let/if operands to unified Expression

ReturnExpression uses Expression?; LetStatement uses = Expression;
if condition uses Expression; ExpressionWithBlock includes block
expressions. Factors one Expression graph per Rust Reference.

Addresses blocking api-review on PR #3801 (896aaa6).

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

* fix(rust): wave-2a claim std imports and if-else grammar

Point rust_wave2_grammar_structure at v4.std.grammar/lexing helpers
per #3807 boundary discipline. Model Rust Reference IfExpression else
tail (BlockExpression | IfExpression) and register else lexeme.

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

* WIP: T-4.17 Wave 2a: rust lex/grammar data fill (deps T-6/T-7/T-4; cpp/java e

* WIP: T-4.17 Wave 2a: rust lex/grammar data fill (deps T-6/T-7/T-4; cpp/java e

* WIP: T-4.17 Wave 2a: rust lex/grammar data fill (deps T-6/T-7/T-4; cpp/java e

* fix(rust): formal block tail-only expr and Bool lhs search

Add FormalProduction for `{ Expression }` blocks (Rust Reference §17.11).
Replace RustFormalLhsSearchState coproduct with Bool fold via typed
rust_formal_production_matches_lhs helper (M9 dissolution).

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

* fix(rust): wire MVP-1 FormalProduction into wave-2 list

Include rust_formal_production_mvp1_fn_add() in rust_wave2_formal_productions
so rust_formal_rhs_from_tokens has a consumer; extend structure claim.

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

* fix(rust): layout-free wave-2 lex and param_list formal alignment

Strip embedded whitespace from wave-2 keyword/operator lexeme spellings;
rely on WhitespaceChar trivia. Align FormalProduction param_list with
operational grammar (no trailing comma via param_list_suffix). Add
return; and tight-layout parse claim fixtures (T-22 deferred).

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

* WIP: T-4.17 Wave 2a: rust lex/grammar data fill (deps T-6/T-7/T-4; cpp/java e

* fix(rust): layout-free plus lexeme for wave-2 tight fixtures

Change rust_token_plus LiteralPattern from " + " to "+" so
rust_wave2_lex_rules (wave-1 + wave-2) tokenizes x+1 in layout-tight
claims; whitespace trivia separates tokens.

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

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
@briansrls
briansrls deleted the session/keen-seal-346 branch June 1, 2026 18:42
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