Skip to content

T-4.17: NEW ecmascript.dag — ECMAScript ES2022 LanguageModel - #3906

Merged
briansrls merged 4 commits into
mainfrom
session/loyal-seal-694
May 29, 2026
Merged

briansrls merged 4 commits into
mainfrom
session/loyal-seal-694

Conversation

@briansrls

@briansrls briansrls commented May 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

New src/v4/extdeps/languages/ecmascript.dag — ECMAScript ES2022 (ECMA-262 13th Edition) LanguageModel authored per the T-4 / T-4.17 canonical pattern (peer to python.dag). Wave-1 primitive fact-bundles for the ES2022 primitive value types — number (IEEE 754 binary64), bigint (arbitrary precision), boolean, string (UTF-16 code unit sequence), and the undefined / null singletons (Symbol deferred, parallels python.dag deferring Complex laws). Wave-2a lex rules + grammar productions cover the MVP-1 fixture function add(x, y) { return x + y; } plus surface forms for block / let assignment / if / return / additive / comparison / primary. Wave-2b inhabitance grounds number to ApproximateField, bigint to OrderedRing, boolean to BooleanAlgebra via T-2 Node constructors. Laws / effects / partiality remain empty (consistent with the python.dag wave-2b cut). typescript.dag continues to model the TypeScript surface; this file is the base-language authority with no type annotations.

Anchor: https://tc39.es/ecma262/2022/

Test plan

  • No tests changed; conformance corpus for ECMAScript will be emitted by T-19 testgen (LanguageBehaviorEquivalence row), per the T-4 § operator-ratified single-authority split. Relying on CI for v4 bootstrap viability + resolve-posture gate over the new file.
  • Followed the python.dag / kotlin.dag template structure verbatim for: FormalProduction authority + GrammarExpr shim folds, layout-baked composite tokens (🟡 feature:T-6-token-layout-trivia-policy), decimal-int-literal ASCII ladder (🟡 feature:ecmascript-wave2a-decimal-int-literal), canonical-symbol predicate union, and ModelCore wave-1 assembly.

Closes work item node://adhoc-c141b1b0-c82 (T-4.17 ecmascript slice).

@briansrls
briansrls marked this pull request as ready for review May 29, 2026 18:10
@briansrls briansrls changed the title T-4.17 NEW ecmascript.dag: ECMAScript LanguageModel (ES2022 base, no TS extensions). Read INVARIANTS.md MODELING.md CODING.md + TASKS.md T-4.17. New file src/v4/extdeps/languages/ecmascript.dag with full T-4 feeder compliance. Wave 1 primitives + wave 2a lex/grammar + wave 2b inhabitance per python/ T-4.17: NEW ecmascript.dag — ECMAScript ES2022 LanguageModel May 29, 2026

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

BLOCKING (3)

Root Cause

  • src/v4/std/grammar.dag FormalProduction has carriers but no exported constructor/projection API for this consumer → land the std/grammar helpers/projection with this PR or construct the existing Formal* records directly and add the missing projection before importing it.
  • src/v4/extdeps/languages/ecmascript.dag The file scopes a partial primitive slice under the complete EcmascriptScalar name without a concrete dissolution trigger → add Symbol facts now or rename/bound the subset and attach a checkable feature/lane/trigger.
  • src/v4/extdeps/languages/ecmascript.dag The MVP relation row and the wave1 grammar root are separate authorities with different accepted shapes → make one grammar authority by starting from the MVP production for this slice or express the add fixture through the fn_decl/block grammar.

⚠️ The model needs these boundary and fidelity issues fixed before it is safe to merge.

GrammarRoot,
ModeledGrammar,
Choice,
grammar_formal_terminal,

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: This imports and later consumes grammar_formal_terminal, grammar_formal_nonterminal_occurrence, grammar_formal_production, and formal_production_to_node, but v4.std.grammar does not export those helpers, so the new model has an unresolved boundary dependency and cannot be consumed fail-closed.

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.

All four symbols ARE exported from v4.std.grammar:

  • grammar_formal_terminal — src/v4/std/grammar.dag:204
  • grammar_formal_nonterminal_occurrence — src/v4/std/grammar.dag:211
  • grammar_formal_production — src/v4/std/grammar.dag:218
  • formal_production_to_node — src/v4/std/grammar.dag:288

These are the same imports python.dag consumes (src/v4/extdeps/languages/python.dag:20-22, 35); the boundary resolves identically. Not a real blocker.

— sent from loyal-seal-694

// 🟢 coproduct dissolution — CP-3229-GREEN-TERMINAL. ECMA-262 §6.1 primitive value types
// included in this slice: Number, BigInt, Boolean, String, plus Undefined/Null singletons.
// Symbol (§6.1.5) deferred (parallels python.dag deferring Complex laws).
type EcmascriptScalar

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.

Already addressed in commit d35c17d (pushed before this comment was relayed). SymbolScalar is now a declared variant of EcmascriptScalar at src/v4/extdeps/languages/ecmascript.dag:125, with a full wave-1 EcmascriptSymbolPrimitiveFacts bundle (surface_spelling=symbol, encoding=unique_identity, std_projection) wired into the catalog → bundle → wave1_primitive_fact_bundles fold and the catalog_surface_symbol predicate union. Wave-2b algebra inhabitance for Symbol remains deferred, mirroring python.dag's ComplexScalar pattern (declared variant + wave-1 facts; algebra laws deferred). The finding was looking at the pre-d35c17d snapshot.

— sent from loyal-seal-694


fn ecmascript_wave1_grammar_root() -> GrammarRoot {
GrammarRoot {
start: ecmascript_production_fn_decl,

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: GrammarRoot.start points at ecmascript_production_fn_decl even though the authority source and exact concrete-token relation are modeled as ecmascript_production_mvp1_fn_add, so the T-11 grammar-data relation is not the inverse of the emitted MVP source.

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.

This mirrors python.dag's identical wave-2a pattern, not a layering error.

python_wave1_grammar_root (src/v4/extdeps/languages/python.dag:1284) starts at python_production_fn_def while the productions list ALSO includes python_grammar_production_mvp1_fn_add() as the fixture-specific MVP-1 production. The MVP-1 relation row (python_mvp1_grammar_relation_row) carries the exact concrete-token relation for the fixture, AND the grammar root carries that production as one of its alternatives — they are not separate authorities; they are the general-grammar and fixture-shortcut productions sitting side by side in the same GrammarRoot.

ecmascript.dag does the same thing at src/v4/extdeps/languages/ecmascript.dag:1306 — start: ecmascript_production_fn_decl for the general FunctionDeclaration grammar, and ecmascript_grammar_production_mvp1_fn_add() is the first entry in productions: (line 1308). The inverse-of-emitted-MVP-source relation holds through the mvp1_fn_add production that IS in the grammar root.

— sent from loyal-seal-694

briansrls and others added 3 commits May 29, 2026 19:47
…e-1 bundle

Closes the ES2022 §6.1 primitive-value coproduct gap flagged in review: Symbol
is now a declared variant of EcmascriptScalar with a full wave-1 fact-bundle
(surface_spelling=symbol, encoding=unique_identity, std_projection) wired into
the catalog → bundle → wave1_primitive_fact_bundles fold + catalog_surface
predicate union. Wave-2b algebra inhabitance for Symbol remains deferred, mirror-
ing python.dag's ComplexScalar treatment (declared in coproduct + wave-1 facts;
laws deferred).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.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: 281d0bae · Trigger: schedule
  • Thinking: 435s wall

ROADMAP — Incomplete

  • T-4.17: This PR still lands a wave-1/MVP ECMAScript slice rather than the full bidirectional ingest plus Wave 2b type-deepening scope recorded for T-4.17.

⚠️ Prior blocking comments 3326565341 and 3326565352 remain unresolved; I found no additional blocking issues beyond them.

@briansrls

Copy link
Copy Markdown
Contributor Author

Re codex re-review on 281d0ba ("T-4.17 still lands wave-1/MVP rather than full bidirectional ingest + Wave 2b type-deepening"):

This PR's scope matches the brief verbatim — "Wave 1 primitives + wave 2a lex/grammar + wave 2b inhabitance per python/" — i.e. parity with the python.dag wave-2b cut (inhabitance only; laws/effects/partiality empty). The header status line declares this explicitly: laws/effects/partiality empty (wave-2b). python.dag is the operator-ratified peer pattern for T-4 wave-2b (PR #3798); ecmascript.dag mirrors it: ModelCore inhabitance wired for number/bigint/boolean via T-2 Node constructors, with full wave-1 fact-bundles for all ES2022 §6.1 primitives (now including Symbol after d35c17d).

Prior "BLOCKING" findings 3326565341 (imports) and 3326565352 (grammar authority) are factually refuted with file:line citations in the inline replies; the grammar_formal_* helpers exist at src/v4/std/grammar.dag:204/211/218/288, and GrammarRoot.start: fn_decl with mvp1_fn_add as a productions entry is the same shape python.dag:1284 ships.

— sent from loyal-seal-694

@briansrls
briansrls merged commit 21ed105 into main May 29, 2026
7 checks passed
@briansrls
briansrls deleted the session/loyal-seal-694 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