From 885603b58baba7ae04f8bc6ba05edcb2a2efd998 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Mon, 6 Jul 2026 04:40:19 +0000 Subject: [PATCH 1/5] WIP: dedup dag.dag mvp1 fn families into parameterized cores --- src/v2/extdeps/languages/dag.dag | 334 +++++++++++++++++++------------ 1 file changed, 205 insertions(+), 129 deletions(-) diff --git a/src/v2/extdeps/languages/dag.dag b/src/v2/extdeps/languages/dag.dag index ce8cc7f1e3d..a8a91b559fb 100644 --- a/src/v2/extdeps/languages/dag.dag +++ b/src/v2/extdeps/languages/dag.dag @@ -48,8 +48,10 @@ import v2.std.grammar { grammar_production_to_node, grammar_relation_tokens_node, grammar_empty_sync_tokens, + derive_grammar_relation_row, derive_grammar_relation_row_node, formal_production_for_lhs_exact, + grammar_relation_row_to_node, node_atom_identity_optional } import v2.std.witness { Holds, Violates, Witness } @@ -111,6 +113,7 @@ import v2.std.compilers.target_model { concrete_syntax_token_to_node, TargetBindingRefShape, TargetBodiedArrowStatementScaffold, + TargetEmitHostRuntimeRow, TargetCallApplyShape, TargetClosureShape, TargetConditionalShape, @@ -163,6 +166,23 @@ data dag_mvp1_rec_source_text: String = "fn mk() -> Rec { Rec { v: 9 } }" data dag_mvp1_field_access_source_text: String = "fn get(r: Rec) -> Int { r.v }" +type DagGrammarRelationRow { + production: FormalProduction + emitted: Node + tokens: List +} + +type DagMvp1BodiedFnFamilySpec { + inhabitant_field: Symbol + emitted_fn: Node + grammar_row: DagGrammarRelationRow + source_literal: Symbol + production_binding: Symbol + authority_source_text: String + relation_rule: Symbol + scaffold: TargetBodiedArrowStatementScaffold +} + fn dag_mvp1_concrete_tokens() -> List { [ FixedToken { token_class: ^dag_token_kw_fn }, @@ -3334,147 +3354,57 @@ data dag_mvp1_fixture_emitted_add_fn: Node = Node { } fn dag_mvp1_pick_zip_fold_closure_edges() -> List { - [ - dag_named_edge( - name: ^dag_inhabitant_field_mvp1_pick_fn, - target: dag_mvp1_fixture_emitted_pick_fn - ) - ] + dag_mvp1_bodied_fn_zip_fold_closure_edges(spec: dag_mvp1_pick_family_spec()) } fn dag_mvp1_pick_declared_inhabitants_root() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: list_append( - left: list_append( - left: dag_declared_inhabitants_core().children, - right: dag_mvp1_zip_fold_closure_edges() - ), - right: dag_mvp1_pick_zip_fold_closure_edges() - ), - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_declared_inhabitants_root(spec: dag_mvp1_pick_family_spec()) } fn dag_mvp1_bind_zip_fold_closure_edges() -> List { - [ - dag_named_edge( - name: ^dag_inhabitant_field_mvp1_bind_fn, - target: dag_mvp1_fixture_emitted_bind_fn - ) - ] + dag_mvp1_bodied_fn_zip_fold_closure_edges(spec: dag_mvp1_bind_family_spec()) } fn dag_mvp1_bind_declared_inhabitants_root() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: list_append( - left: list_append( - left: dag_declared_inhabitants_core().children, - right: dag_mvp1_zip_fold_closure_edges() - ), - right: dag_mvp1_bind_zip_fold_closure_edges() - ), - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_declared_inhabitants_root(spec: dag_mvp1_bind_family_spec()) } fn dag_mvp1_loop_zip_fold_closure_edges() -> List { - [ - dag_named_edge( - name: ^dag_inhabitant_field_mvp1_loop_fn, - target: dag_mvp1_fixture_emitted_loop_fn - ) - ] + dag_mvp1_bodied_fn_zip_fold_closure_edges(spec: dag_mvp1_loop_family_spec()) } fn dag_mvp1_loop_declared_inhabitants_root() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: list_append( - left: list_append( - left: dag_declared_inhabitants_core().children, - right: dag_mvp1_zip_fold_closure_edges() - ), - right: dag_mvp1_loop_zip_fold_closure_edges() - ), - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_declared_inhabitants_root(spec: dag_mvp1_loop_family_spec()) } data dag_inhabitant_field_mvp1_match_fn: Symbol = dag_inhabitant_field_mvp1_match_fn fn dag_mvp1_match_zip_fold_closure_edges() -> List { - [ - dag_named_edge( - name: dag_inhabitant_field_mvp1_match_fn, - target: dag_mvp1_fixture_emitted_match_fn - ) - ] + dag_mvp1_bodied_fn_zip_fold_closure_edges(spec: dag_mvp1_match_family_spec()) } fn dag_mvp1_match_declared_inhabitants_root() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: list_append( - left: list_append( - left: dag_declared_inhabitants_core().children, - right: dag_mvp1_zip_fold_closure_edges() - ), - right: dag_mvp1_match_zip_fold_closure_edges() - ), - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_declared_inhabitants_root(spec: dag_mvp1_match_family_spec()) } data dag_inhabitant_field_mvp1_rec_fn: Symbol = dag_inhabitant_field_mvp1_rec_fn fn dag_mvp1_rec_zip_fold_closure_edges() -> List { - [ - dag_named_edge( - name: dag_inhabitant_field_mvp1_rec_fn, - target: dag_mvp1_fixture_emitted_rec_fn - ) - ] + dag_mvp1_bodied_fn_zip_fold_closure_edges(spec: dag_mvp1_rec_family_spec()) } fn dag_mvp1_rec_declared_inhabitants_root() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: list_append( - left: list_append( - left: dag_declared_inhabitants_core().children, - right: dag_mvp1_zip_fold_closure_edges() - ), - right: dag_mvp1_rec_zip_fold_closure_edges() - ), - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_declared_inhabitants_root(spec: dag_mvp1_rec_family_spec()) } data dag_inhabitant_field_mvp1_field_access_fn: Symbol = dag_inhabitant_field_mvp1_field_access_fn fn dag_mvp1_field_access_zip_fold_closure_edges() -> List { - [ - dag_named_edge( - name: dag_inhabitant_field_mvp1_field_access_fn, - target: dag_mvp1_fixture_emitted_field_access_fn - ) - ] + dag_mvp1_bodied_fn_zip_fold_closure_edges(spec: dag_mvp1_field_access_family_spec()) } fn dag_mvp1_field_access_declared_inhabitants_root() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: list_append( - left: list_append( - left: dag_declared_inhabitants_core().children, - right: dag_mvp1_zip_fold_closure_edges() - ), - right: dag_mvp1_field_access_zip_fold_closure_edges() - ), - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_declared_inhabitants_root(spec: dag_mvp1_field_access_family_spec()) } fn dag_mvp1_zip_fold_closure_edges() -> List { @@ -3546,12 +3476,12 @@ fn dag_mvp1_serialize_source_children() -> List { } fn dag_mvp1_serialize_source_node() -> Node { - let _authority = dag_mvp1_source_text - Node { - kind: TypeNode { connective: Conj }, - children: dag_mvp1_serialize_source_children(), - occurrence_id: SyntheticOccurrence -} + dag_mvp1_family_serialize_source_node( + source_literal: ^dag_mvp1_source_literal, + production_binding: ^dag_production_mvp1_fn_add, + tokens: dag_mvp1_concrete_tokens(), + authority_source_text: dag_mvp1_source_text + ) } type DagGramBuild1State @@ -4033,27 +3963,13 @@ fn dag_type_decl_structural_target_model() -> TargetModel { } fn dag_mvp1_grammar_relation_row_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^grammar_relation_field_production, - target: formal_production_to_node(production: dag_formal_production_mvp1_fn_add()) - ), - dag_named_edge( - name: ^grammar_relation_field_emitted, - target: dag_mvp1_emitted_add_fn_node() - ), - dag_named_edge( - name: ^grammar_relation_field_tokens, - target: grammar_relation_tokens_node( - tokens: dag_mvp1_concrete_tokens(), - token_to_node: dag_concrete_token_node - ) - ) - ], - occurrence_id: SyntheticOccurrence -} + dag_grammar_relation_row_node( + row: DagGrammarRelationRow { + production: dag_formal_production_mvp1_fn_add(), + emitted: dag_mvp1_emitted_add_fn_node(), + tokens: dag_mvp1_concrete_tokens() + } + ) } fn dag_mvp1_translation_rules_node() -> Node { @@ -5034,6 +4950,166 @@ fn dag_operator_realizations_catalog_node() -> Node { target_operator_realizations_catalog_node(rows: []) } +fn dag_grammar_relation_row_node(row: DagGrammarRelationRow) -> Node { + grammar_relation_row_to_node( + row: derive_grammar_relation_row(production: row.production, emitted: row.emitted), + tokens: grammar_relation_tokens_node( + tokens: row.tokens, + token_to_node: dag_concrete_token_node + ) + ) +} + +fn dag_mvp1_family_serialize_source_node( + source_literal: Symbol, + production_binding: Symbol, + tokens: List, + authority_source_text: String +) -> Node { + let _authority = authority_source_text + Node { + kind: TypeNode { connective: Conj }, + children: list_append( + left: [ + dag_named_edge( + name: ^serialize_source_field_source_text, + target: dag_inhabitant_atom(id: source_literal) + ), + dag_named_edge( + name: ^serialize_source_field_source_grammar, + target: dag_inhabitant_atom(id: production_binding) + ) + ], + right: [ + dag_named_edge( + name: ^grammar_relation_field_tokens, + target: grammar_relation_tokens_node( + tokens: tokens, + token_to_node: dag_concrete_token_node + ) + ) + ] + ), + occurrence_id: SyntheticOccurrence + } +} + +fn dag_mvp1_bodied_fn_zip_fold_closure_edges(spec: DagMvp1BodiedFnFamilySpec) -> List { + [ + dag_named_edge( + name: spec.inhabitant_field, + target: spec.emitted_fn + ) + ] +} + +fn dag_mvp1_bodied_fn_declared_inhabitants_root(spec: DagMvp1BodiedFnFamilySpec) -> Node { + Node { + kind: TypeNode { connective: Conj }, + children: list_append( + left: list_append( + left: dag_declared_inhabitants_core().children, + right: dag_mvp1_zip_fold_closure_edges() + ), + right: dag_mvp1_bodied_fn_zip_fold_closure_edges(spec: spec) + ), + occurrence_id: SyntheticOccurrence + } +} + +fn dag_mvp1_bodied_fn_grammar_relation_row_node(spec: DagMvp1BodiedFnFamilySpec) -> Node { + dag_grammar_relation_row_node(row: spec.grammar_row) +} + +fn dag_mvp1_bodied_fn_translation_rules_node(spec: DagMvp1BodiedFnFamilySpec) -> Node { + Node { + kind: TypeNode { connective: Conj }, + children: [ + dag_named_edge( + name: spec.relation_rule, + target: grammar_relation_row_attach_bodied_scaffold( + row: dag_mvp1_bodied_fn_grammar_relation_row_node(spec: spec), + scaffold: spec.scaffold + ) + ) + ], + occurrence_id: SyntheticOccurrence + } +} + +fn dag_mvp1_bodied_fn_serialize_source_node(spec: DagMvp1BodiedFnFamilySpec) -> Node { + dag_mvp1_family_serialize_source_node( + source_literal: spec.source_literal, + production_binding: spec.production_binding, + tokens: spec.grammar_row.tokens, + authority_source_text: spec.authority_source_text + ) +} + +fn dag_mvp1_bodied_fn_target_model_bundle_node(spec: DagMvp1BodiedFnFamilySpec) -> Node { + Node { + kind: TypeNode { connective: Conj }, + children: [ + dag_named_edge( + name: ^target_model_edge_selection_policy, + target: dag_mvp1_selection_policy_node() + ), + dag_named_edge( + name: ^target_model_edge_declared_inhabitants, + target: dag_mvp1_bodied_fn_declared_inhabitants_root(spec: spec) + ), + dag_named_edge( + name: ^target_model_edge_translation_rules, + target: dag_mvp1_bodied_fn_translation_rules_node(spec: spec) + ), + dag_named_edge( + name: ^target_model_edge_serialize_source, + target: dag_mvp1_bodied_fn_serialize_source_node(spec: spec) + ), + dag_named_edge( + name: ^target_model_edge_fidelity_quotient, + target: dag_mvp1_fidelity_quotient_node() + ), + dag_named_edge( + name: ^target_model_edge_value_expression_projection, + target: value_expr_projection_bundle_node( + projection: dag_value_expression_projection() + ) + ), + dag_named_edge( + name: ^target_model_edge_operator_realizations, + target: dag_operator_realizations_catalog_node() + ) + ], + occurrence_id: SyntheticOccurrence + } +} + +fn dag_mvp1_bodied_fn_target_model( + spec: DagMvp1BodiedFnFamilySpec, + runtime_row: Optional +) -> TargetModel { + match runtime_row { + Present { value: row } => + TargetModel { + bundle: dag_mvp1_bodied_fn_target_model_bundle_node(spec: spec), + lex: dag_wave1_lex(), + binding_spellings: dag_mvp1_binding_spellings(), + token_class_emit_transforms: target_model_emit_transforms_empty, + authority_source_text: spec.authority_source_text, + runtime_row: row + } + Absent => + TargetModel { + bundle: dag_mvp1_bodied_fn_target_model_bundle_node(spec: spec), + lex: dag_wave1_lex(), + binding_spellings: dag_mvp1_binding_spellings(), + token_class_emit_transforms: target_model_emit_transforms_empty, + authority_source_text: spec.authority_source_text + } + } +} + fn dag_mvp1_pick_statement_prefix_tokens() -> List { [ FixedToken { token_class: ^dag_token_kw_fn }, From 657164b923e325c1feebcd2a17dc926114675998 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Mon, 6 Jul 2026 04:50:39 +0000 Subject: [PATCH 2/5] WIP: dedup dag.dag mvp1 fn families into parameterized cores --- src/v2/extdeps/languages/dag.dag | 1357 +++++++----------------------- 1 file changed, 286 insertions(+), 1071 deletions(-) diff --git a/src/v2/extdeps/languages/dag.dag b/src/v2/extdeps/languages/dag.dag index a8a91b559fb..4057fae89ce 100644 --- a/src/v2/extdeps/languages/dag.dag +++ b/src/v2/extdeps/languages/dag.dag @@ -3488,21 +3488,24 @@ type DagGramBuild1State = DagGramBuild1StateInit | DagGramBuild1StateReady { expr: GrammarExpr } -fn dag_grammar_sequence_from_token_classes() -> GrammarExpr { +fn dag_grammar_sequence_from_concrete_tokens( + tokens: List, + terminal_for_token: fn(ConcreteSyntaxToken) -> GrammarExpr +) -> GrammarExpr { match fold_list( - xs: dag_mvp1_concrete_tokens(), + xs: tokens, empty: DagGramBuild1StateInit, cons: fn(state, token) { match state { DagGramBuild1StateInit => DagGramBuild1StateReady { - expr: dag_grammar_terminal_from_concrete_token(token: token) + expr: terminal_for_token(token: token) } DagGramBuild1StateReady { expr: acc } => DagGramBuild1StateReady { expr: Sequence { left: acc, - right: dag_grammar_terminal_from_concrete_token(token: token) + right: terminal_for_token(token: token) } } } @@ -3514,6 +3517,13 @@ fn dag_grammar_sequence_from_token_classes() -> GrammarExpr { } } +fn dag_grammar_sequence_from_token_classes() -> GrammarExpr { + dag_grammar_sequence_from_concrete_tokens( + tokens: dag_mvp1_concrete_tokens(), + terminal_for_token: dag_grammar_terminal_from_concrete_token + ) +} + fn dag_formal_grammar_symbol_from_token(token: ConcreteSyntaxToken) -> FormalGrammarSymbol { match token { FixedToken { token_class: c } => grammar_formal_terminal(identity: c) @@ -3616,29 +3626,10 @@ fn dag_grammar_terminal_for_mvp1_loop_token(token: ConcreteSyntaxToken) -> Gramm } fn dag_grammar_sequence_from_token_classes_loop() -> GrammarExpr { - match fold_list( - xs: dag_mvp1_loop_concrete_tokens(), - empty: DagGramBuild1StateInit, - cons: fn(state, token) { - match state { - DagGramBuild1StateInit => - DagGramBuild1StateReady { - expr: dag_grammar_terminal_for_mvp1_loop_token(token: token) - } - DagGramBuild1StateReady { expr: acc } => - DagGramBuild1StateReady { - expr: Sequence { - left: acc, - right: dag_grammar_terminal_for_mvp1_loop_token(token: token) - } - } - } - } - ) { - DagGramBuild1StateInit => - dag_grammar_terminal(token_class: ^dag_token_kw_fn) - DagGramBuild1StateReady { expr: result } => result - } + dag_grammar_sequence_from_concrete_tokens( + tokens: dag_mvp1_loop_concrete_tokens(), + terminal_for_token: dag_grammar_terminal_for_mvp1_loop_token + ) } fn dag_grammar_production_mvp1_fn_loop() -> GrammarProduction { @@ -3711,29 +3702,10 @@ fn dag_grammar_terminal_for_mvp1_pick_token(token: ConcreteSyntaxToken) -> Gramm } fn dag_grammar_sequence_from_token_classes_pick() -> GrammarExpr { - match fold_list( - xs: dag_mvp1_pick_concrete_tokens(), - empty: DagGramBuild1StateInit, - cons: fn(state, token) { - match state { - DagGramBuild1StateInit => - DagGramBuild1StateReady { - expr: dag_grammar_terminal_for_mvp1_pick_token(token: token) - } - DagGramBuild1StateReady { expr: acc } => - DagGramBuild1StateReady { - expr: Sequence { - left: acc, - right: dag_grammar_terminal_for_mvp1_pick_token(token: token) - } - } - } - } - ) { - DagGramBuild1StateInit => - dag_grammar_terminal(token_class: ^dag_token_kw_fn) - DagGramBuild1StateReady { expr: result } => result - } + dag_grammar_sequence_from_concrete_tokens( + tokens: dag_mvp1_pick_concrete_tokens(), + terminal_for_token: dag_grammar_terminal_for_mvp1_pick_token + ) } fn dag_grammar_match_arm_literal_binding(binding: Symbol) -> Bool { @@ -3759,29 +3731,10 @@ fn dag_grammar_terminal_for_mvp1_match_token(token: ConcreteSyntaxToken) -> Gram } fn dag_grammar_sequence_from_token_classes_match() -> GrammarExpr { - match fold_list( - xs: dag_mvp1_match_concrete_tokens(), - empty: DagGramBuild1StateInit, - cons: fn(state, token) { - match state { - DagGramBuild1StateInit => - DagGramBuild1StateReady { - expr: dag_grammar_terminal_for_mvp1_match_token(token: token) - } - DagGramBuild1StateReady { expr: acc } => - DagGramBuild1StateReady { - expr: Sequence { - left: acc, - right: dag_grammar_terminal_for_mvp1_match_token(token: token) - } - } - } - } - ) { - DagGramBuild1StateInit => - dag_grammar_terminal(token_class: ^dag_token_kw_fn) - DagGramBuild1StateReady { expr: result } => result - } + dag_grammar_sequence_from_concrete_tokens( + tokens: dag_mvp1_match_concrete_tokens(), + terminal_for_token: dag_grammar_terminal_for_mvp1_match_token + ) } fn dag_grammar_rec_field_literal_binding(binding: Symbol) -> Bool { @@ -3803,29 +3756,10 @@ fn dag_grammar_terminal_for_mvp1_rec_token(token: ConcreteSyntaxToken) -> Gramma } fn dag_grammar_sequence_from_token_classes_rec() -> GrammarExpr { - match fold_list( - xs: dag_mvp1_rec_concrete_tokens(), - empty: DagGramBuild1StateInit, - cons: fn(state, token) { - match state { - DagGramBuild1StateInit => - DagGramBuild1StateReady { - expr: dag_grammar_terminal_for_mvp1_rec_token(token: token) - } - DagGramBuild1StateReady { expr: acc } => - DagGramBuild1StateReady { - expr: Sequence { - left: acc, - right: dag_grammar_terminal_for_mvp1_rec_token(token: token) - } - } - } - } - ) { - DagGramBuild1StateInit => - dag_grammar_terminal(token_class: ^dag_token_kw_fn) - DagGramBuild1StateReady { expr: result } => result - } + dag_grammar_sequence_from_concrete_tokens( + tokens: dag_mvp1_rec_concrete_tokens(), + terminal_for_token: dag_grammar_terminal_for_mvp1_rec_token + ) } fn dag_grammar_terminal_for_mvp1_field_access_token(token: ConcreteSyntaxToken) -> GrammarExpr { @@ -3833,29 +3767,10 @@ fn dag_grammar_terminal_for_mvp1_field_access_token(token: ConcreteSyntaxToken) } fn dag_grammar_sequence_from_token_classes_field_access() -> GrammarExpr { - match fold_list( - xs: dag_mvp1_field_access_concrete_tokens(), - empty: DagGramBuild1StateInit, - cons: fn(state, token) { - match state { - DagGramBuild1StateInit => - DagGramBuild1StateReady { - expr: dag_grammar_terminal_for_mvp1_field_access_token(token: token) - } - DagGramBuild1StateReady { expr: acc } => - DagGramBuild1StateReady { - expr: Sequence { - left: acc, - right: dag_grammar_terminal_for_mvp1_field_access_token(token: token) - } - } - } - } - ) { - DagGramBuild1StateInit => - dag_grammar_terminal(token_class: ^dag_token_kw_fn) - DagGramBuild1StateReady { expr: result } => result - } + dag_grammar_sequence_from_concrete_tokens( + tokens: dag_mvp1_field_access_concrete_tokens(), + terminal_for_token: dag_grammar_terminal_for_mvp1_field_access_token + ) } fn dag_type_decl_structural_formal_productions() -> List { @@ -4142,53 +4057,19 @@ fn dag_mvp1_loop_body_wrong_value_node() -> Node { } fn dag_mvp1_loop_arrow_with_body_node() -> Node { - Node { - kind: TypeNode { connective: Arrow }, - children: [ - Edge { - label: Positional, - target: dag_mvp1_pick_arrow_domain_conj_node() - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Named { name: ^arrow_body_edge }, - target: dag_mvp1_loop_body_node() - } - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_arrow_with_body_node( + domain: dag_mvp1_pick_arrow_domain_conj_node(), + return_type_binding: ^dag_binding_type_int, + body: dag_mvp1_loop_body_node() + ) } fn dag_mvp1_loop_arrow_with_body_wrong_value_node() -> Node { - Node { - kind: TypeNode { connective: Arrow }, - children: [ - Edge { - label: Positional, - target: dag_mvp1_pick_arrow_domain_conj_node() - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Named { name: ^arrow_body_edge }, - target: dag_mvp1_loop_body_wrong_value_node() - } - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_arrow_with_body_node( + domain: dag_mvp1_pick_arrow_domain_conj_node(), + return_type_binding: ^dag_binding_type_int, + body: dag_mvp1_loop_body_wrong_value_node() + ) } data dag_mvp1_loop_body_fixture: Node = dag_mvp1_loop_body_node() @@ -4242,6 +4123,29 @@ fn dag_mvp1_type_atom_node(identity: Symbol) -> Node { } } +fn dag_mvp1_arrow_with_body_node( + domain: Node, + return_type_binding: Symbol, + body: Node +) -> Node { + Node { + kind: TypeNode { connective: Arrow }, + children: [ + Edge { label: Positional, target: domain }, + Edge { + label: Positional, + target: dag_mvp1_type_atom_node(identity: return_type_binding) + }, + Edge { + label: Positional, + target: dag_mvp1_type_atom_node(identity: return_type_binding) + }, + Edge { label: Named { name: ^arrow_body_edge }, target: body } + ], + occurrence_id: SyntheticOccurrence + } +} + fn dag_mvp1_add_operator_node() -> Node { dag_mvp1_type_atom_node(identity: ^dag_token_plus) } @@ -4323,53 +4227,19 @@ fn dag_mvp1_add_binary_body_swapped_operands_node() -> Node { } fn dag_mvp1_add_arrow_with_body_node() -> Node { - Node { - kind: TypeNode { connective: Arrow }, - children: [ - Edge { - label: Positional, - target: dag_mvp1_arrow_domain_conj_node() - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Named { name: ^arrow_body_edge }, - target: dag_mvp1_add_binary_body_node() - } - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_arrow_with_body_node( + domain: dag_mvp1_arrow_domain_conj_node(), + return_type_binding: ^dag_binding_type_int, + body: dag_mvp1_add_binary_body_node() + ) } fn dag_mvp1_add_arrow_with_body_swapped_operands_node() -> Node { - Node { - kind: TypeNode { connective: Arrow }, - children: [ - Edge { - label: Positional, - target: dag_mvp1_arrow_domain_conj_node() - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Named { name: ^arrow_body_edge }, - target: dag_mvp1_add_binary_body_swapped_operands_node() - } - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_arrow_with_body_node( + domain: dag_mvp1_arrow_domain_conj_node(), + return_type_binding: ^dag_binding_type_int, + body: dag_mvp1_add_binary_body_swapped_operands_node() + ) } data dag_mvp1_add_arrow_signature_fixture: Node = dag_mvp1_add_arrow_signature_node() @@ -4419,53 +4289,19 @@ fn dag_mvp1_pick_if_body_swapped_arms_node() -> Node { } fn dag_mvp1_pick_arrow_with_body_node() -> Node { - Node { - kind: TypeNode { connective: Arrow }, - children: [ - Edge { - label: Positional, - target: dag_mvp1_pick_arrow_domain_conj_node() - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Named { name: ^arrow_body_edge }, - target: dag_mvp1_pick_if_body_node() - } - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_arrow_with_body_node( + domain: dag_mvp1_pick_arrow_domain_conj_node(), + return_type_binding: ^dag_binding_type_int, + body: dag_mvp1_pick_if_body_node() + ) } fn dag_mvp1_pick_arrow_with_body_swapped_arms_node() -> Node { - Node { - kind: TypeNode { connective: Arrow }, - children: [ - Edge { - label: Positional, - target: dag_mvp1_pick_arrow_domain_conj_node() - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Named { name: ^arrow_body_edge }, - target: dag_mvp1_pick_if_body_swapped_arms_node() - } - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_arrow_with_body_node( + domain: dag_mvp1_pick_arrow_domain_conj_node(), + return_type_binding: ^dag_binding_type_int, + body: dag_mvp1_pick_if_body_swapped_arms_node() + ) } data dag_mvp1_pick_if_body_fixture: Node = dag_mvp1_pick_if_body_node() @@ -4537,53 +4373,19 @@ fn dag_mvp1_match_body_swapped_arms_node() -> Node { } fn dag_mvp1_match_arrow_with_body_node() -> Node { - Node { - kind: TypeNode { connective: Arrow }, - children: [ - Edge { - label: Positional, - target: dag_mvp1_pick_arrow_domain_conj_node() - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Named { name: ^arrow_body_edge }, - target: dag_mvp1_match_body_node() - } - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_arrow_with_body_node( + domain: dag_mvp1_pick_arrow_domain_conj_node(), + return_type_binding: ^dag_binding_type_int, + body: dag_mvp1_match_body_node() + ) } fn dag_mvp1_match_arrow_with_body_swapped_arms_node() -> Node { - Node { - kind: TypeNode { connective: Arrow }, - children: [ - Edge { - label: Positional, - target: dag_mvp1_pick_arrow_domain_conj_node() - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Named { name: ^arrow_body_edge }, - target: dag_mvp1_match_body_swapped_arms_node() - } - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_arrow_with_body_node( + domain: dag_mvp1_pick_arrow_domain_conj_node(), + return_type_binding: ^dag_binding_type_int, + body: dag_mvp1_match_body_swapped_arms_node() + ) } data dag_mvp1_match_if_body_fixture: Node = dag_mvp1_match_body_node() @@ -4610,28 +4412,11 @@ fn dag_mvp1_rec_construct_body_node() -> Node { } fn dag_mvp1_rec_arrow_with_body_node() -> Node { - Node { - kind: TypeNode { connective: Arrow }, - children: [ - Edge { - label: Positional, - target: dag_mvp1_pick_arrow_domain_conj_node() - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_rec) - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_rec) - }, - Edge { - label: Named { name: ^arrow_body_edge }, - target: dag_mvp1_rec_construct_body_node() - } - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_arrow_with_body_node( + domain: dag_mvp1_pick_arrow_domain_conj_node(), + return_type_binding: ^dag_binding_type_rec, + body: dag_mvp1_rec_construct_body_node() + ) } data dag_mvp1_rec_construct_body_fixture: Node = dag_mvp1_rec_construct_body_node() @@ -4673,28 +4458,11 @@ fn dag_mvp1_field_access_arrow_domain_conj_node() -> Node { } fn dag_mvp1_field_access_arrow_with_body_node() -> Node { - Node { - kind: TypeNode { connective: Arrow }, - children: [ - Edge { - label: Positional, - target: dag_mvp1_field_access_arrow_domain_conj_node() - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Named { name: ^arrow_body_edge }, - target: dag_mvp1_field_access_body_node() - } - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_arrow_with_body_node( + domain: dag_mvp1_field_access_arrow_domain_conj_node(), + return_type_binding: ^dag_binding_type_int, + body: dag_mvp1_field_access_body_node() + ) } data dag_mvp1_field_access_body_fixture: Node = dag_mvp1_field_access_body_node() @@ -4743,53 +4511,19 @@ fn dag_mvp1_bind_let_body_wrong_value_node() -> Node { } fn dag_mvp1_bind_arrow_with_body_node() -> Node { - Node { - kind: TypeNode { connective: Arrow }, - children: [ - Edge { - label: Positional, - target: dag_mvp1_pick_arrow_domain_conj_node() - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Named { name: ^arrow_body_edge }, - target: dag_mvp1_bind_let_body_node() - } - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_arrow_with_body_node( + domain: dag_mvp1_pick_arrow_domain_conj_node(), + return_type_binding: ^dag_binding_type_int, + body: dag_mvp1_bind_let_body_node() + ) } fn dag_mvp1_bind_arrow_with_body_wrong_value_node() -> Node { - Node { - kind: TypeNode { connective: Arrow }, - children: [ - Edge { - label: Positional, - target: dag_mvp1_pick_arrow_domain_conj_node() - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Named { name: ^arrow_body_edge }, - target: dag_mvp1_bind_let_body_wrong_value_node() - } - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_arrow_with_body_node( + domain: dag_mvp1_pick_arrow_domain_conj_node(), + return_type_binding: ^dag_binding_type_int, + body: dag_mvp1_bind_let_body_wrong_value_node() + ) } data dag_mvp1_bind_let_body_fixture: Node = dag_mvp1_bind_let_body_node() @@ -4827,29 +4561,10 @@ fn dag_grammar_terminal_for_mvp1_bind_token(token: ConcreteSyntaxToken) -> Gramm } fn dag_grammar_sequence_from_token_classes_bind() -> GrammarExpr { - match fold_list( - xs: dag_mvp1_bind_concrete_tokens(), - empty: DagGramBuild1StateInit, - cons: fn(state, token) { - match state { - DagGramBuild1StateInit => - DagGramBuild1StateReady { - expr: dag_grammar_terminal_for_mvp1_bind_token(token: token) - } - DagGramBuild1StateReady { expr: acc } => - DagGramBuild1StateReady { - expr: Sequence { - left: acc, - right: dag_grammar_terminal_for_mvp1_bind_token(token: token) - } - } - } - } - ) { - DagGramBuild1StateInit => - dag_grammar_terminal(token_class: ^dag_token_kw_fn) - DagGramBuild1StateReady { expr: result } => result - } + dag_grammar_sequence_from_concrete_tokens( + tokens: dag_mvp1_bind_concrete_tokens(), + terminal_for_token: dag_grammar_terminal_for_mvp1_bind_token + ) } fn dag_grammar_production_mvp1_fn_bind() -> GrammarProduction { @@ -5110,18 +4825,28 @@ fn dag_mvp1_bodied_fn_target_model( } } -fn dag_mvp1_pick_statement_prefix_tokens() -> List { +fn dag_mvp1_nullary_fn_statement_prefix_tokens( + fn_name_binding: Symbol, + return_type_binding: Symbol +) -> List { [ FixedToken { token_class: ^dag_token_kw_fn }, - BoundToken { token_class: ^dag_token_ident, binding: ^dag_binding_fn_one_or_two }, + BoundToken { token_class: ^dag_token_ident, binding: fn_name_binding }, FixedToken { token_class: ^dag_token_lparen }, FixedToken { token_class: ^dag_token_rparen }, FixedToken { token_class: ^dag_token_arrow }, - BoundToken { token_class: ^dag_token_ident, binding: ^dag_binding_type_int }, + BoundToken { token_class: ^dag_token_ident, binding: return_type_binding }, FixedToken { token_class: ^dag_token_lbrace } ] } +fn dag_mvp1_pick_statement_prefix_tokens() -> List { + dag_mvp1_nullary_fn_statement_prefix_tokens( + fn_name_binding: ^dag_binding_fn_one_or_two, + return_type_binding: ^dag_binding_type_int + ) +} + fn dag_mvp1_pick_statement_suffix_tokens() -> List { [FixedToken { token_class: ^dag_token_rbrace }] } @@ -5134,139 +4859,51 @@ fn dag_mvp1_pick_bodied_arrow_statement_scaffold() -> TargetBodiedArrowStatement ) } -fn dag_mvp1_pick_grammar_relation_row_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^grammar_relation_field_production, - target: formal_production_to_node(production: dag_formal_production_mvp1_fn_pick()) - ), - dag_named_edge( - name: ^grammar_relation_field_emitted, - target: dag_mvp1_fixture_emitted_pick_fn - ), - dag_named_edge( - name: ^grammar_relation_field_tokens, - target: grammar_relation_tokens_node( - tokens: dag_mvp1_pick_concrete_tokens(), - token_to_node: dag_concrete_token_node - ) - ) - ], - occurrence_id: SyntheticOccurrence +fn dag_mvp1_pick_family_spec() -> DagMvp1BodiedFnFamilySpec { + DagMvp1BodiedFnFamilySpec { + inhabitant_field: ^dag_inhabitant_field_mvp1_pick_fn, + emitted_fn: dag_mvp1_fixture_emitted_pick_fn, + grammar_row: DagGrammarRelationRow { + production: dag_formal_production_mvp1_fn_pick(), + emitted: dag_mvp1_fixture_emitted_pick_fn, + tokens: dag_mvp1_pick_concrete_tokens() + }, + source_literal: ^dag_mvp1_pick_source_literal, + production_binding: ^dag_production_mvp1_fn_pick, + authority_source_text: dag_mvp1_pick_source_text, + relation_rule: ^dag_relation_rule_mvp1_fn_pick, + scaffold: dag_mvp1_pick_bodied_arrow_statement_scaffold() } } -fn dag_mvp1_pick_serialize_source_children() -> List { - list_append( - left: [ - dag_named_edge( - name: ^serialize_source_field_source_text, - target: dag_inhabitant_atom(id: ^dag_mvp1_pick_source_literal) - ), - dag_named_edge( - name: ^serialize_source_field_source_grammar, - target: dag_inhabitant_atom(id: ^dag_production_mvp1_fn_pick) - ) - ], - right: [ - dag_named_edge( - name: ^grammar_relation_field_tokens, - target: grammar_relation_tokens_node( - tokens: dag_mvp1_pick_concrete_tokens(), - token_to_node: dag_concrete_token_node - ) - ) - ] - ) +fn dag_mvp1_pick_grammar_relation_row_node() -> Node { + dag_mvp1_bodied_fn_grammar_relation_row_node(spec: dag_mvp1_pick_family_spec()) } fn dag_mvp1_pick_serialize_source_node() -> Node { - let _authority = dag_mvp1_pick_source_text - Node { - kind: TypeNode { connective: Conj }, - children: dag_mvp1_pick_serialize_source_children(), - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_serialize_source_node(spec: dag_mvp1_pick_family_spec()) } fn dag_mvp1_pick_translation_rules_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^dag_relation_rule_mvp1_fn_pick, - target: grammar_relation_row_attach_bodied_scaffold( - row: dag_mvp1_pick_grammar_relation_row_node(), - scaffold: dag_mvp1_pick_bodied_arrow_statement_scaffold() - ) - ) - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_translation_rules_node(spec: dag_mvp1_pick_family_spec()) } fn dag_mvp1_pick_target_model_bundle_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^target_model_edge_selection_policy, - target: dag_mvp1_selection_policy_node() - ), - dag_named_edge( - name: ^target_model_edge_declared_inhabitants, - target: dag_mvp1_pick_declared_inhabitants_root() - ), - dag_named_edge( - name: ^target_model_edge_translation_rules, - target: dag_mvp1_pick_translation_rules_node() - ), - dag_named_edge( - name: ^target_model_edge_serialize_source, - target: dag_mvp1_pick_serialize_source_node() - ), - dag_named_edge( - name: ^target_model_edge_fidelity_quotient, - target: dag_mvp1_fidelity_quotient_node() - ), - dag_named_edge( - name: ^target_model_edge_value_expression_projection, - target: value_expr_projection_bundle_node( - projection: dag_value_expression_projection() - ) - ), - dag_named_edge( - name: ^target_model_edge_operator_realizations, - target: dag_operator_realizations_catalog_node() - ) - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_target_model_bundle_node(spec: dag_mvp1_pick_family_spec()) } fn dag_mvp1_pick_target_model() -> TargetModel { - TargetModel { - bundle: dag_mvp1_pick_target_model_bundle_node(), - lex: dag_wave1_lex(), - binding_spellings: dag_mvp1_binding_spellings(), - token_class_emit_transforms: target_model_emit_transforms_empty, - authority_source_text: dag_mvp1_pick_source_text, - runtime_row: target_emit_host_runtime_row_unconfigured - } + dag_mvp1_bodied_fn_target_model( + spec: dag_mvp1_pick_family_spec(), + runtime_row: Present { value: target_emit_host_runtime_row_unconfigured } + ) } fn dag_mvp1_bind_statement_prefix_tokens() -> List { - [ - FixedToken { token_class: ^dag_token_kw_fn }, - BoundToken { token_class: ^dag_token_ident, binding: ^dag_binding_fn_one }, - FixedToken { token_class: ^dag_token_lparen }, - FixedToken { token_class: ^dag_token_rparen }, - FixedToken { token_class: ^dag_token_arrow }, - BoundToken { token_class: ^dag_token_ident, binding: ^dag_binding_type_int }, - FixedToken { token_class: ^dag_token_lbrace } - ] + dag_mvp1_nullary_fn_statement_prefix_tokens( + fn_name_binding: ^dag_binding_fn_one, + return_type_binding: ^dag_binding_type_int + ) } fn dag_mvp1_bind_bodied_arrow_statement_scaffold() -> TargetBodiedArrowStatementScaffold { @@ -5277,139 +4914,51 @@ fn dag_mvp1_bind_bodied_arrow_statement_scaffold() -> TargetBodiedArrowStatement ) } +fn dag_mvp1_bind_family_spec() -> DagMvp1BodiedFnFamilySpec { + DagMvp1BodiedFnFamilySpec { + inhabitant_field: ^dag_inhabitant_field_mvp1_bind_fn, + emitted_fn: dag_mvp1_fixture_emitted_bind_fn, + grammar_row: DagGrammarRelationRow { + production: dag_formal_production_mvp1_fn_bind(), + emitted: dag_mvp1_fixture_emitted_bind_fn, + tokens: dag_mvp1_bind_concrete_tokens() + }, + source_literal: ^dag_mvp1_bind_source_literal, + production_binding: ^dag_production_mvp1_fn_bind, + authority_source_text: dag_mvp1_bind_source_text, + relation_rule: ^dag_relation_rule_mvp1_fn_bind, + scaffold: dag_mvp1_bind_bodied_arrow_statement_scaffold() + } +} + fn dag_mvp1_bind_grammar_relation_row_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^grammar_relation_field_production, - target: formal_production_to_node(production: dag_formal_production_mvp1_fn_bind()) - ), - dag_named_edge( - name: ^grammar_relation_field_emitted, - target: dag_mvp1_fixture_emitted_bind_fn - ), - dag_named_edge( - name: ^grammar_relation_field_tokens, - target: grammar_relation_tokens_node( - tokens: dag_mvp1_bind_concrete_tokens(), - token_to_node: dag_concrete_token_node - ) - ) - ], - occurrence_id: SyntheticOccurrence - } -} - -fn dag_mvp1_bind_serialize_source_children() -> List { - list_append( - left: [ - dag_named_edge( - name: ^serialize_source_field_source_text, - target: dag_inhabitant_atom(id: ^dag_mvp1_bind_source_literal) - ), - dag_named_edge( - name: ^serialize_source_field_source_grammar, - target: dag_inhabitant_atom(id: ^dag_production_mvp1_fn_bind) - ) - ], - right: [ - dag_named_edge( - name: ^grammar_relation_field_tokens, - target: grammar_relation_tokens_node( - tokens: dag_mvp1_bind_concrete_tokens(), - token_to_node: dag_concrete_token_node - ) - ) - ] - ) + dag_mvp1_bodied_fn_grammar_relation_row_node(spec: dag_mvp1_bind_family_spec()) } fn dag_mvp1_bind_serialize_source_node() -> Node { - let _authority = dag_mvp1_bind_source_text - Node { - kind: TypeNode { connective: Conj }, - children: dag_mvp1_bind_serialize_source_children(), - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_serialize_source_node(spec: dag_mvp1_bind_family_spec()) } fn dag_mvp1_bind_translation_rules_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^dag_relation_rule_mvp1_fn_bind, - target: grammar_relation_row_attach_bodied_scaffold( - row: dag_mvp1_bind_grammar_relation_row_node(), - scaffold: dag_mvp1_bind_bodied_arrow_statement_scaffold() - ) - ) - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_translation_rules_node(spec: dag_mvp1_bind_family_spec()) } fn dag_mvp1_bind_target_model_bundle_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^target_model_edge_selection_policy, - target: dag_mvp1_selection_policy_node() - ), - dag_named_edge( - name: ^target_model_edge_declared_inhabitants, - target: dag_mvp1_bind_declared_inhabitants_root() - ), - dag_named_edge( - name: ^target_model_edge_translation_rules, - target: dag_mvp1_bind_translation_rules_node() - ), - dag_named_edge( - name: ^target_model_edge_serialize_source, - target: dag_mvp1_bind_serialize_source_node() - ), - dag_named_edge( - name: ^target_model_edge_fidelity_quotient, - target: dag_mvp1_fidelity_quotient_node() - ), - dag_named_edge( - name: ^target_model_edge_value_expression_projection, - target: value_expr_projection_bundle_node( - projection: dag_value_expression_projection() - ) - ), - dag_named_edge( - name: ^target_model_edge_operator_realizations, - target: dag_operator_realizations_catalog_node() - ) - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_target_model_bundle_node(spec: dag_mvp1_bind_family_spec()) } fn dag_mvp1_bind_target_model() -> TargetModel { - TargetModel { - bundle: dag_mvp1_bind_target_model_bundle_node(), - lex: dag_wave1_lex(), - binding_spellings: dag_mvp1_binding_spellings(), - token_class_emit_transforms: target_model_emit_transforms_empty, - authority_source_text: dag_mvp1_bind_source_text, - runtime_row: target_emit_host_runtime_row_unconfigured - } + dag_mvp1_bodied_fn_target_model( + spec: dag_mvp1_bind_family_spec(), + runtime_row: Present { value: target_emit_host_runtime_row_unconfigured } + ) } fn dag_mvp1_loop_statement_prefix_tokens() -> List { - [ - FixedToken { token_class: ^dag_token_kw_fn }, - BoundToken { token_class: ^dag_token_ident, binding: ^dag_binding_fn_one }, - FixedToken { token_class: ^dag_token_lparen }, - FixedToken { token_class: ^dag_token_rparen }, - FixedToken { token_class: ^dag_token_arrow }, - BoundToken { token_class: ^dag_token_ident, binding: ^dag_binding_type_int }, - FixedToken { token_class: ^dag_token_lbrace } - ] + dag_mvp1_nullary_fn_statement_prefix_tokens( + fn_name_binding: ^dag_binding_fn_one, + return_type_binding: ^dag_binding_type_int + ) } fn dag_mvp1_loop_bodied_arrow_statement_scaffold() -> TargetBodiedArrowStatementScaffold { @@ -5420,261 +4969,91 @@ fn dag_mvp1_loop_bodied_arrow_statement_scaffold() -> TargetBodiedArrowStatement ) } -fn dag_mvp1_loop_grammar_relation_row_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^grammar_relation_field_production, - target: formal_production_to_node(production: dag_formal_production_mvp1_fn_loop()) - ), - dag_named_edge( - name: ^grammar_relation_field_emitted, - target: dag_mvp1_fixture_emitted_loop_fn - ), - dag_named_edge( - name: ^grammar_relation_field_tokens, - target: grammar_relation_tokens_node( - tokens: dag_mvp1_loop_concrete_tokens(), - token_to_node: dag_concrete_token_node - ) - ) - ], - occurrence_id: SyntheticOccurrence +fn dag_mvp1_loop_family_spec() -> DagMvp1BodiedFnFamilySpec { + DagMvp1BodiedFnFamilySpec { + inhabitant_field: ^dag_inhabitant_field_mvp1_loop_fn, + emitted_fn: dag_mvp1_fixture_emitted_loop_fn, + grammar_row: DagGrammarRelationRow { + production: dag_formal_production_mvp1_fn_loop(), + emitted: dag_mvp1_fixture_emitted_loop_fn, + tokens: dag_mvp1_loop_concrete_tokens() + }, + source_literal: ^dag_mvp1_loop_source_literal, + production_binding: ^dag_production_mvp1_fn_loop, + authority_source_text: dag_mvp1_loop_source_text, + relation_rule: ^dag_relation_rule_mvp1_fn_loop, + scaffold: dag_mvp1_loop_bodied_arrow_statement_scaffold() } } -fn dag_mvp1_loop_serialize_source_children() -> List { - list_append( - left: [ - dag_named_edge( - name: ^serialize_source_field_source_text, - target: dag_inhabitant_atom(id: ^dag_mvp1_loop_source_literal) - ), - dag_named_edge( - name: ^serialize_source_field_source_grammar, - target: dag_inhabitant_atom(id: ^dag_production_mvp1_fn_loop) - ) - ], - right: [ - dag_named_edge( - name: ^grammar_relation_field_tokens, - target: grammar_relation_tokens_node( - tokens: dag_mvp1_loop_concrete_tokens(), - token_to_node: dag_concrete_token_node - ) - ) - ] - ) +fn dag_mvp1_loop_grammar_relation_row_node() -> Node { + dag_mvp1_bodied_fn_grammar_relation_row_node(spec: dag_mvp1_loop_family_spec()) } fn dag_mvp1_loop_serialize_source_node() -> Node { - let _authority = dag_mvp1_loop_source_text - Node { - kind: TypeNode { connective: Conj }, - children: dag_mvp1_loop_serialize_source_children(), - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_serialize_source_node(spec: dag_mvp1_loop_family_spec()) } fn dag_mvp1_loop_translation_rules_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^dag_relation_rule_mvp1_fn_loop, - target: grammar_relation_row_attach_bodied_scaffold( - row: dag_mvp1_loop_grammar_relation_row_node(), - scaffold: dag_mvp1_loop_bodied_arrow_statement_scaffold() - ) - ) - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_translation_rules_node(spec: dag_mvp1_loop_family_spec()) } fn dag_mvp1_loop_target_model_bundle_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^target_model_edge_selection_policy, - target: dag_mvp1_selection_policy_node() - ), - dag_named_edge( - name: ^target_model_edge_declared_inhabitants, - target: dag_mvp1_loop_declared_inhabitants_root() - ), - dag_named_edge( - name: ^target_model_edge_translation_rules, - target: dag_mvp1_loop_translation_rules_node() - ), - dag_named_edge( - name: ^target_model_edge_serialize_source, - target: dag_mvp1_loop_serialize_source_node() - ), - dag_named_edge( - name: ^target_model_edge_fidelity_quotient, - target: dag_mvp1_fidelity_quotient_node() - ), - dag_named_edge( - name: ^target_model_edge_value_expression_projection, - target: value_expr_projection_bundle_node( - projection: dag_value_expression_projection() - ) - ), - dag_named_edge( - name: ^target_model_edge_operator_realizations, - target: dag_operator_realizations_catalog_node() - ) - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_target_model_bundle_node(spec: dag_mvp1_loop_family_spec()) } fn dag_mvp1_loop_target_model() -> TargetModel { - TargetModel { - bundle: dag_mvp1_loop_target_model_bundle_node(), - lex: dag_wave1_lex(), - binding_spellings: dag_mvp1_binding_spellings(), - token_class_emit_transforms: target_model_emit_transforms_empty, - authority_source_text: dag_mvp1_loop_source_text, - runtime_row: target_emit_host_runtime_row_unconfigured - } + dag_mvp1_bodied_fn_target_model( + spec: dag_mvp1_loop_family_spec(), + runtime_row: Present { value: target_emit_host_runtime_row_unconfigured } + ) } -fn dag_mvp1_match_grammar_relation_row_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^grammar_relation_field_production, - target: formal_production_to_node(production: dag_formal_production_mvp1_fn_match()) - ), - dag_named_edge( - name: ^grammar_relation_field_emitted, - target: dag_mvp1_fixture_emitted_match_fn - ), - dag_named_edge( - name: ^grammar_relation_field_tokens, - target: grammar_relation_tokens_node( - tokens: dag_mvp1_match_concrete_tokens(), - token_to_node: dag_concrete_token_node - ) - ) - ], - occurrence_id: SyntheticOccurrence +fn dag_mvp1_match_family_spec() -> DagMvp1BodiedFnFamilySpec { + DagMvp1BodiedFnFamilySpec { + inhabitant_field: dag_inhabitant_field_mvp1_match_fn, + emitted_fn: dag_mvp1_fixture_emitted_match_fn, + grammar_row: DagGrammarRelationRow { + production: dag_formal_production_mvp1_fn_match(), + emitted: dag_mvp1_fixture_emitted_match_fn, + tokens: dag_mvp1_match_concrete_tokens() + }, + source_literal: ^dag_mvp1_match_source_literal, + production_binding: ^dag_production_mvp1_fn_match, + authority_source_text: dag_mvp1_match_source_text, + relation_rule: ^dag_relation_rule_mvp1_fn_match, + scaffold: dag_mvp1_pick_bodied_arrow_statement_scaffold() } } -fn dag_mvp1_match_serialize_source_children() -> List { - list_append( - left: [ - dag_named_edge( - name: ^serialize_source_field_source_text, - target: dag_inhabitant_atom(id: ^dag_mvp1_match_source_literal) - ), - dag_named_edge( - name: ^serialize_source_field_source_grammar, - target: dag_inhabitant_atom(id: ^dag_production_mvp1_fn_match) - ) - ], - right: [ - dag_named_edge( - name: ^grammar_relation_field_tokens, - target: grammar_relation_tokens_node( - tokens: dag_mvp1_match_concrete_tokens(), - token_to_node: dag_concrete_token_node - ) - ) - ] - ) +fn dag_mvp1_match_grammar_relation_row_node() -> Node { + dag_mvp1_bodied_fn_grammar_relation_row_node(spec: dag_mvp1_match_family_spec()) } fn dag_mvp1_match_serialize_source_node() -> Node { - let _authority = dag_mvp1_match_source_text - Node { - kind: TypeNode { connective: Conj }, - children: dag_mvp1_match_serialize_source_children(), - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_serialize_source_node(spec: dag_mvp1_match_family_spec()) } fn dag_mvp1_match_translation_rules_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^dag_relation_rule_mvp1_fn_match, - target: grammar_relation_row_attach_bodied_scaffold( - row: dag_mvp1_match_grammar_relation_row_node(), - scaffold: dag_mvp1_pick_bodied_arrow_statement_scaffold() - ) - ) - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_translation_rules_node(spec: dag_mvp1_match_family_spec()) } fn dag_mvp1_match_target_model_bundle_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^target_model_edge_selection_policy, - target: dag_mvp1_selection_policy_node() - ), - dag_named_edge( - name: ^target_model_edge_declared_inhabitants, - target: dag_mvp1_match_declared_inhabitants_root() - ), - dag_named_edge( - name: ^target_model_edge_translation_rules, - target: dag_mvp1_match_translation_rules_node() - ), - dag_named_edge( - name: ^target_model_edge_serialize_source, - target: dag_mvp1_match_serialize_source_node() - ), - dag_named_edge( - name: ^target_model_edge_fidelity_quotient, - target: dag_mvp1_fidelity_quotient_node() - ), - dag_named_edge( - name: ^target_model_edge_value_expression_projection, - target: value_expr_projection_bundle_node( - projection: dag_value_expression_projection() - ) - ), - dag_named_edge( - name: ^target_model_edge_operator_realizations, - target: dag_operator_realizations_catalog_node() - ) - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_target_model_bundle_node(spec: dag_mvp1_match_family_spec()) } fn dag_mvp1_match_target_model() -> TargetModel { - TargetModel { - bundle: dag_mvp1_match_target_model_bundle_node(), - lex: dag_wave1_lex(), - binding_spellings: dag_mvp1_binding_spellings(), - token_class_emit_transforms: target_model_emit_transforms_empty, - authority_source_text: dag_mvp1_match_source_text - } + dag_mvp1_bodied_fn_target_model( + spec: dag_mvp1_match_family_spec(), + runtime_row: Absent + ) } fn dag_mvp1_rec_statement_prefix_tokens() -> List { - [ - FixedToken { token_class: ^dag_token_kw_fn }, - BoundToken { token_class: ^dag_token_ident, binding: ^dag_binding_fn_mk }, - FixedToken { token_class: ^dag_token_lparen }, - FixedToken { token_class: ^dag_token_rparen }, - FixedToken { token_class: ^dag_token_arrow }, - BoundToken { token_class: ^dag_token_ident, binding: ^dag_binding_type_rec }, - FixedToken { token_class: ^dag_token_lbrace } - ] + dag_mvp1_nullary_fn_statement_prefix_tokens( + fn_name_binding: ^dag_binding_fn_mk, + return_type_binding: ^dag_binding_type_rec + ) } fn dag_mvp1_rec_bodied_arrow_statement_scaffold() -> TargetBodiedArrowStatementScaffold { @@ -5685,126 +5064,44 @@ fn dag_mvp1_rec_bodied_arrow_statement_scaffold() -> TargetBodiedArrowStatementS ) } -fn dag_mvp1_rec_grammar_relation_row_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^grammar_relation_field_production, - target: formal_production_to_node(production: dag_formal_production_mvp1_fn_rec()) - ), - dag_named_edge( - name: ^grammar_relation_field_emitted, - target: dag_mvp1_fixture_emitted_rec_fn - ), - dag_named_edge( - name: ^grammar_relation_field_tokens, - target: grammar_relation_tokens_node( - tokens: dag_mvp1_rec_concrete_tokens(), - token_to_node: dag_concrete_token_node - ) - ) - ], - occurrence_id: SyntheticOccurrence +fn dag_mvp1_rec_family_spec() -> DagMvp1BodiedFnFamilySpec { + DagMvp1BodiedFnFamilySpec { + inhabitant_field: dag_inhabitant_field_mvp1_rec_fn, + emitted_fn: dag_mvp1_fixture_emitted_rec_fn, + grammar_row: DagGrammarRelationRow { + production: dag_formal_production_mvp1_fn_rec(), + emitted: dag_mvp1_fixture_emitted_rec_fn, + tokens: dag_mvp1_rec_concrete_tokens() + }, + source_literal: ^dag_mvp1_rec_source_literal, + production_binding: ^dag_production_mvp1_fn_rec, + authority_source_text: dag_mvp1_rec_source_text, + relation_rule: ^dag_relation_rule_mvp1_fn_rec, + scaffold: dag_mvp1_rec_bodied_arrow_statement_scaffold() } } -fn dag_mvp1_rec_serialize_source_children() -> List { - list_append( - left: [ - dag_named_edge( - name: ^serialize_source_field_source_text, - target: dag_inhabitant_atom(id: ^dag_mvp1_rec_source_literal) - ), - dag_named_edge( - name: ^serialize_source_field_source_grammar, - target: dag_inhabitant_atom(id: ^dag_production_mvp1_fn_rec) - ) - ], - right: [ - dag_named_edge( - name: ^grammar_relation_field_tokens, - target: grammar_relation_tokens_node( - tokens: dag_mvp1_rec_concrete_tokens(), - token_to_node: dag_concrete_token_node - ) - ) - ] - ) +fn dag_mvp1_rec_grammar_relation_row_node() -> Node { + dag_mvp1_bodied_fn_grammar_relation_row_node(spec: dag_mvp1_rec_family_spec()) } fn dag_mvp1_rec_serialize_source_node() -> Node { - let _authority = dag_mvp1_rec_source_text - Node { - kind: TypeNode { connective: Conj }, - children: dag_mvp1_rec_serialize_source_children(), - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_serialize_source_node(spec: dag_mvp1_rec_family_spec()) } fn dag_mvp1_rec_translation_rules_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^dag_relation_rule_mvp1_fn_rec, - target: grammar_relation_row_attach_bodied_scaffold( - row: dag_mvp1_rec_grammar_relation_row_node(), - scaffold: dag_mvp1_rec_bodied_arrow_statement_scaffold() - ) - ) - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_translation_rules_node(spec: dag_mvp1_rec_family_spec()) } fn dag_mvp1_rec_target_model_bundle_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^target_model_edge_selection_policy, - target: dag_mvp1_selection_policy_node() - ), - dag_named_edge( - name: ^target_model_edge_declared_inhabitants, - target: dag_mvp1_rec_declared_inhabitants_root() - ), - dag_named_edge( - name: ^target_model_edge_translation_rules, - target: dag_mvp1_rec_translation_rules_node() - ), - dag_named_edge( - name: ^target_model_edge_serialize_source, - target: dag_mvp1_rec_serialize_source_node() - ), - dag_named_edge( - name: ^target_model_edge_fidelity_quotient, - target: dag_mvp1_fidelity_quotient_node() - ), - dag_named_edge( - name: ^target_model_edge_value_expression_projection, - target: value_expr_projection_bundle_node( - projection: dag_value_expression_projection() - ) - ), - dag_named_edge( - name: ^target_model_edge_operator_realizations, - target: dag_operator_realizations_catalog_node() - ) - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_target_model_bundle_node(spec: dag_mvp1_rec_family_spec()) } fn dag_mvp1_rec_target_model() -> TargetModel { - TargetModel { - bundle: dag_mvp1_rec_target_model_bundle_node(), - lex: dag_wave1_lex(), - binding_spellings: dag_mvp1_binding_spellings(), - token_class_emit_transforms: target_model_emit_transforms_empty, - authority_source_text: dag_mvp1_rec_source_text - } + dag_mvp1_bodied_fn_target_model( + spec: dag_mvp1_rec_family_spec(), + runtime_row: Absent + ) } fn dag_mvp1_field_access_statement_prefix_tokens() -> List { @@ -5830,126 +5127,44 @@ fn dag_mvp1_field_access_bodied_arrow_statement_scaffold() -> TargetBodiedArrowS ) } -fn dag_mvp1_field_access_grammar_relation_row_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^grammar_relation_field_production, - target: formal_production_to_node(production: dag_formal_production_mvp1_fn_field_access()) - ), - dag_named_edge( - name: ^grammar_relation_field_emitted, - target: dag_mvp1_fixture_emitted_field_access_fn - ), - dag_named_edge( - name: ^grammar_relation_field_tokens, - target: grammar_relation_tokens_node( - tokens: dag_mvp1_field_access_concrete_tokens(), - token_to_node: dag_concrete_token_node - ) - ) - ], - occurrence_id: SyntheticOccurrence +fn dag_mvp1_field_access_family_spec() -> DagMvp1BodiedFnFamilySpec { + DagMvp1BodiedFnFamilySpec { + inhabitant_field: dag_inhabitant_field_mvp1_field_access_fn, + emitted_fn: dag_mvp1_fixture_emitted_field_access_fn, + grammar_row: DagGrammarRelationRow { + production: dag_formal_production_mvp1_fn_field_access(), + emitted: dag_mvp1_fixture_emitted_field_access_fn, + tokens: dag_mvp1_field_access_concrete_tokens() + }, + source_literal: ^dag_mvp1_field_access_source_literal, + production_binding: ^dag_production_mvp1_fn_field_access, + authority_source_text: dag_mvp1_field_access_source_text, + relation_rule: ^dag_relation_rule_mvp1_fn_field_access, + scaffold: dag_mvp1_field_access_bodied_arrow_statement_scaffold() } } -fn dag_mvp1_field_access_serialize_source_children() -> List { - list_append( - left: [ - dag_named_edge( - name: ^serialize_source_field_source_text, - target: dag_inhabitant_atom(id: ^dag_mvp1_field_access_source_literal) - ), - dag_named_edge( - name: ^serialize_source_field_source_grammar, - target: dag_inhabitant_atom(id: ^dag_production_mvp1_fn_field_access) - ) - ], - right: [ - dag_named_edge( - name: ^grammar_relation_field_tokens, - target: grammar_relation_tokens_node( - tokens: dag_mvp1_field_access_concrete_tokens(), - token_to_node: dag_concrete_token_node - ) - ) - ] - ) +fn dag_mvp1_field_access_grammar_relation_row_node() -> Node { + dag_mvp1_bodied_fn_grammar_relation_row_node(spec: dag_mvp1_field_access_family_spec()) } fn dag_mvp1_field_access_serialize_source_node() -> Node { - let _authority = dag_mvp1_field_access_source_text - Node { - kind: TypeNode { connective: Conj }, - children: dag_mvp1_field_access_serialize_source_children(), - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_serialize_source_node(spec: dag_mvp1_field_access_family_spec()) } fn dag_mvp1_field_access_translation_rules_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^dag_relation_rule_mvp1_fn_field_access, - target: grammar_relation_row_attach_bodied_scaffold( - row: dag_mvp1_field_access_grammar_relation_row_node(), - scaffold: dag_mvp1_field_access_bodied_arrow_statement_scaffold() - ) - ) - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_translation_rules_node(spec: dag_mvp1_field_access_family_spec()) } fn dag_mvp1_field_access_target_model_bundle_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^target_model_edge_selection_policy, - target: dag_mvp1_selection_policy_node() - ), - dag_named_edge( - name: ^target_model_edge_declared_inhabitants, - target: dag_mvp1_field_access_declared_inhabitants_root() - ), - dag_named_edge( - name: ^target_model_edge_translation_rules, - target: dag_mvp1_field_access_translation_rules_node() - ), - dag_named_edge( - name: ^target_model_edge_serialize_source, - target: dag_mvp1_field_access_serialize_source_node() - ), - dag_named_edge( - name: ^target_model_edge_fidelity_quotient, - target: dag_mvp1_fidelity_quotient_node() - ), - dag_named_edge( - name: ^target_model_edge_value_expression_projection, - target: value_expr_projection_bundle_node( - projection: dag_value_expression_projection() - ) - ), - dag_named_edge( - name: ^target_model_edge_operator_realizations, - target: dag_operator_realizations_catalog_node() - ) - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_target_model_bundle_node(spec: dag_mvp1_field_access_family_spec()) } fn dag_mvp1_field_access_target_model() -> TargetModel { - TargetModel { - bundle: dag_mvp1_field_access_target_model_bundle_node(), - lex: dag_wave1_lex(), - binding_spellings: dag_mvp1_binding_spellings(), - token_class_emit_transforms: target_model_emit_transforms_empty, - authority_source_text: dag_mvp1_field_access_source_text - } + dag_mvp1_bodied_fn_target_model( + spec: dag_mvp1_field_access_family_spec(), + runtime_row: Absent + ) } fn dag_mvp1_target_model() -> TargetModel { From 7c874c82dd06d2bfcaede4361e0653d59632690c Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Mon, 6 Jul 2026 04:59:35 +0000 Subject: [PATCH 3/5] Dedup dag.dag mvp1 fn families into parameterized cores. Collapse five repeated stamping clusters (arrow-with-body nodes, target-model bundles, grammar token sequences, grammar-relation rows, statement prefix tokens) into shared parameterized cores with thin per-family wrappers, preserving explicit control-fixture operands at instance sites. Co-authored-by: Cursor --- src/v2/extdeps/languages/dag.dag | 1357 +++++++----------------------- 1 file changed, 286 insertions(+), 1071 deletions(-) diff --git a/src/v2/extdeps/languages/dag.dag b/src/v2/extdeps/languages/dag.dag index a8a91b559fb..4057fae89ce 100644 --- a/src/v2/extdeps/languages/dag.dag +++ b/src/v2/extdeps/languages/dag.dag @@ -3488,21 +3488,24 @@ type DagGramBuild1State = DagGramBuild1StateInit | DagGramBuild1StateReady { expr: GrammarExpr } -fn dag_grammar_sequence_from_token_classes() -> GrammarExpr { +fn dag_grammar_sequence_from_concrete_tokens( + tokens: List, + terminal_for_token: fn(ConcreteSyntaxToken) -> GrammarExpr +) -> GrammarExpr { match fold_list( - xs: dag_mvp1_concrete_tokens(), + xs: tokens, empty: DagGramBuild1StateInit, cons: fn(state, token) { match state { DagGramBuild1StateInit => DagGramBuild1StateReady { - expr: dag_grammar_terminal_from_concrete_token(token: token) + expr: terminal_for_token(token: token) } DagGramBuild1StateReady { expr: acc } => DagGramBuild1StateReady { expr: Sequence { left: acc, - right: dag_grammar_terminal_from_concrete_token(token: token) + right: terminal_for_token(token: token) } } } @@ -3514,6 +3517,13 @@ fn dag_grammar_sequence_from_token_classes() -> GrammarExpr { } } +fn dag_grammar_sequence_from_token_classes() -> GrammarExpr { + dag_grammar_sequence_from_concrete_tokens( + tokens: dag_mvp1_concrete_tokens(), + terminal_for_token: dag_grammar_terminal_from_concrete_token + ) +} + fn dag_formal_grammar_symbol_from_token(token: ConcreteSyntaxToken) -> FormalGrammarSymbol { match token { FixedToken { token_class: c } => grammar_formal_terminal(identity: c) @@ -3616,29 +3626,10 @@ fn dag_grammar_terminal_for_mvp1_loop_token(token: ConcreteSyntaxToken) -> Gramm } fn dag_grammar_sequence_from_token_classes_loop() -> GrammarExpr { - match fold_list( - xs: dag_mvp1_loop_concrete_tokens(), - empty: DagGramBuild1StateInit, - cons: fn(state, token) { - match state { - DagGramBuild1StateInit => - DagGramBuild1StateReady { - expr: dag_grammar_terminal_for_mvp1_loop_token(token: token) - } - DagGramBuild1StateReady { expr: acc } => - DagGramBuild1StateReady { - expr: Sequence { - left: acc, - right: dag_grammar_terminal_for_mvp1_loop_token(token: token) - } - } - } - } - ) { - DagGramBuild1StateInit => - dag_grammar_terminal(token_class: ^dag_token_kw_fn) - DagGramBuild1StateReady { expr: result } => result - } + dag_grammar_sequence_from_concrete_tokens( + tokens: dag_mvp1_loop_concrete_tokens(), + terminal_for_token: dag_grammar_terminal_for_mvp1_loop_token + ) } fn dag_grammar_production_mvp1_fn_loop() -> GrammarProduction { @@ -3711,29 +3702,10 @@ fn dag_grammar_terminal_for_mvp1_pick_token(token: ConcreteSyntaxToken) -> Gramm } fn dag_grammar_sequence_from_token_classes_pick() -> GrammarExpr { - match fold_list( - xs: dag_mvp1_pick_concrete_tokens(), - empty: DagGramBuild1StateInit, - cons: fn(state, token) { - match state { - DagGramBuild1StateInit => - DagGramBuild1StateReady { - expr: dag_grammar_terminal_for_mvp1_pick_token(token: token) - } - DagGramBuild1StateReady { expr: acc } => - DagGramBuild1StateReady { - expr: Sequence { - left: acc, - right: dag_grammar_terminal_for_mvp1_pick_token(token: token) - } - } - } - } - ) { - DagGramBuild1StateInit => - dag_grammar_terminal(token_class: ^dag_token_kw_fn) - DagGramBuild1StateReady { expr: result } => result - } + dag_grammar_sequence_from_concrete_tokens( + tokens: dag_mvp1_pick_concrete_tokens(), + terminal_for_token: dag_grammar_terminal_for_mvp1_pick_token + ) } fn dag_grammar_match_arm_literal_binding(binding: Symbol) -> Bool { @@ -3759,29 +3731,10 @@ fn dag_grammar_terminal_for_mvp1_match_token(token: ConcreteSyntaxToken) -> Gram } fn dag_grammar_sequence_from_token_classes_match() -> GrammarExpr { - match fold_list( - xs: dag_mvp1_match_concrete_tokens(), - empty: DagGramBuild1StateInit, - cons: fn(state, token) { - match state { - DagGramBuild1StateInit => - DagGramBuild1StateReady { - expr: dag_grammar_terminal_for_mvp1_match_token(token: token) - } - DagGramBuild1StateReady { expr: acc } => - DagGramBuild1StateReady { - expr: Sequence { - left: acc, - right: dag_grammar_terminal_for_mvp1_match_token(token: token) - } - } - } - } - ) { - DagGramBuild1StateInit => - dag_grammar_terminal(token_class: ^dag_token_kw_fn) - DagGramBuild1StateReady { expr: result } => result - } + dag_grammar_sequence_from_concrete_tokens( + tokens: dag_mvp1_match_concrete_tokens(), + terminal_for_token: dag_grammar_terminal_for_mvp1_match_token + ) } fn dag_grammar_rec_field_literal_binding(binding: Symbol) -> Bool { @@ -3803,29 +3756,10 @@ fn dag_grammar_terminal_for_mvp1_rec_token(token: ConcreteSyntaxToken) -> Gramma } fn dag_grammar_sequence_from_token_classes_rec() -> GrammarExpr { - match fold_list( - xs: dag_mvp1_rec_concrete_tokens(), - empty: DagGramBuild1StateInit, - cons: fn(state, token) { - match state { - DagGramBuild1StateInit => - DagGramBuild1StateReady { - expr: dag_grammar_terminal_for_mvp1_rec_token(token: token) - } - DagGramBuild1StateReady { expr: acc } => - DagGramBuild1StateReady { - expr: Sequence { - left: acc, - right: dag_grammar_terminal_for_mvp1_rec_token(token: token) - } - } - } - } - ) { - DagGramBuild1StateInit => - dag_grammar_terminal(token_class: ^dag_token_kw_fn) - DagGramBuild1StateReady { expr: result } => result - } + dag_grammar_sequence_from_concrete_tokens( + tokens: dag_mvp1_rec_concrete_tokens(), + terminal_for_token: dag_grammar_terminal_for_mvp1_rec_token + ) } fn dag_grammar_terminal_for_mvp1_field_access_token(token: ConcreteSyntaxToken) -> GrammarExpr { @@ -3833,29 +3767,10 @@ fn dag_grammar_terminal_for_mvp1_field_access_token(token: ConcreteSyntaxToken) } fn dag_grammar_sequence_from_token_classes_field_access() -> GrammarExpr { - match fold_list( - xs: dag_mvp1_field_access_concrete_tokens(), - empty: DagGramBuild1StateInit, - cons: fn(state, token) { - match state { - DagGramBuild1StateInit => - DagGramBuild1StateReady { - expr: dag_grammar_terminal_for_mvp1_field_access_token(token: token) - } - DagGramBuild1StateReady { expr: acc } => - DagGramBuild1StateReady { - expr: Sequence { - left: acc, - right: dag_grammar_terminal_for_mvp1_field_access_token(token: token) - } - } - } - } - ) { - DagGramBuild1StateInit => - dag_grammar_terminal(token_class: ^dag_token_kw_fn) - DagGramBuild1StateReady { expr: result } => result - } + dag_grammar_sequence_from_concrete_tokens( + tokens: dag_mvp1_field_access_concrete_tokens(), + terminal_for_token: dag_grammar_terminal_for_mvp1_field_access_token + ) } fn dag_type_decl_structural_formal_productions() -> List { @@ -4142,53 +4057,19 @@ fn dag_mvp1_loop_body_wrong_value_node() -> Node { } fn dag_mvp1_loop_arrow_with_body_node() -> Node { - Node { - kind: TypeNode { connective: Arrow }, - children: [ - Edge { - label: Positional, - target: dag_mvp1_pick_arrow_domain_conj_node() - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Named { name: ^arrow_body_edge }, - target: dag_mvp1_loop_body_node() - } - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_arrow_with_body_node( + domain: dag_mvp1_pick_arrow_domain_conj_node(), + return_type_binding: ^dag_binding_type_int, + body: dag_mvp1_loop_body_node() + ) } fn dag_mvp1_loop_arrow_with_body_wrong_value_node() -> Node { - Node { - kind: TypeNode { connective: Arrow }, - children: [ - Edge { - label: Positional, - target: dag_mvp1_pick_arrow_domain_conj_node() - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Named { name: ^arrow_body_edge }, - target: dag_mvp1_loop_body_wrong_value_node() - } - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_arrow_with_body_node( + domain: dag_mvp1_pick_arrow_domain_conj_node(), + return_type_binding: ^dag_binding_type_int, + body: dag_mvp1_loop_body_wrong_value_node() + ) } data dag_mvp1_loop_body_fixture: Node = dag_mvp1_loop_body_node() @@ -4242,6 +4123,29 @@ fn dag_mvp1_type_atom_node(identity: Symbol) -> Node { } } +fn dag_mvp1_arrow_with_body_node( + domain: Node, + return_type_binding: Symbol, + body: Node +) -> Node { + Node { + kind: TypeNode { connective: Arrow }, + children: [ + Edge { label: Positional, target: domain }, + Edge { + label: Positional, + target: dag_mvp1_type_atom_node(identity: return_type_binding) + }, + Edge { + label: Positional, + target: dag_mvp1_type_atom_node(identity: return_type_binding) + }, + Edge { label: Named { name: ^arrow_body_edge }, target: body } + ], + occurrence_id: SyntheticOccurrence + } +} + fn dag_mvp1_add_operator_node() -> Node { dag_mvp1_type_atom_node(identity: ^dag_token_plus) } @@ -4323,53 +4227,19 @@ fn dag_mvp1_add_binary_body_swapped_operands_node() -> Node { } fn dag_mvp1_add_arrow_with_body_node() -> Node { - Node { - kind: TypeNode { connective: Arrow }, - children: [ - Edge { - label: Positional, - target: dag_mvp1_arrow_domain_conj_node() - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Named { name: ^arrow_body_edge }, - target: dag_mvp1_add_binary_body_node() - } - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_arrow_with_body_node( + domain: dag_mvp1_arrow_domain_conj_node(), + return_type_binding: ^dag_binding_type_int, + body: dag_mvp1_add_binary_body_node() + ) } fn dag_mvp1_add_arrow_with_body_swapped_operands_node() -> Node { - Node { - kind: TypeNode { connective: Arrow }, - children: [ - Edge { - label: Positional, - target: dag_mvp1_arrow_domain_conj_node() - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Named { name: ^arrow_body_edge }, - target: dag_mvp1_add_binary_body_swapped_operands_node() - } - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_arrow_with_body_node( + domain: dag_mvp1_arrow_domain_conj_node(), + return_type_binding: ^dag_binding_type_int, + body: dag_mvp1_add_binary_body_swapped_operands_node() + ) } data dag_mvp1_add_arrow_signature_fixture: Node = dag_mvp1_add_arrow_signature_node() @@ -4419,53 +4289,19 @@ fn dag_mvp1_pick_if_body_swapped_arms_node() -> Node { } fn dag_mvp1_pick_arrow_with_body_node() -> Node { - Node { - kind: TypeNode { connective: Arrow }, - children: [ - Edge { - label: Positional, - target: dag_mvp1_pick_arrow_domain_conj_node() - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Named { name: ^arrow_body_edge }, - target: dag_mvp1_pick_if_body_node() - } - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_arrow_with_body_node( + domain: dag_mvp1_pick_arrow_domain_conj_node(), + return_type_binding: ^dag_binding_type_int, + body: dag_mvp1_pick_if_body_node() + ) } fn dag_mvp1_pick_arrow_with_body_swapped_arms_node() -> Node { - Node { - kind: TypeNode { connective: Arrow }, - children: [ - Edge { - label: Positional, - target: dag_mvp1_pick_arrow_domain_conj_node() - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Named { name: ^arrow_body_edge }, - target: dag_mvp1_pick_if_body_swapped_arms_node() - } - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_arrow_with_body_node( + domain: dag_mvp1_pick_arrow_domain_conj_node(), + return_type_binding: ^dag_binding_type_int, + body: dag_mvp1_pick_if_body_swapped_arms_node() + ) } data dag_mvp1_pick_if_body_fixture: Node = dag_mvp1_pick_if_body_node() @@ -4537,53 +4373,19 @@ fn dag_mvp1_match_body_swapped_arms_node() -> Node { } fn dag_mvp1_match_arrow_with_body_node() -> Node { - Node { - kind: TypeNode { connective: Arrow }, - children: [ - Edge { - label: Positional, - target: dag_mvp1_pick_arrow_domain_conj_node() - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Named { name: ^arrow_body_edge }, - target: dag_mvp1_match_body_node() - } - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_arrow_with_body_node( + domain: dag_mvp1_pick_arrow_domain_conj_node(), + return_type_binding: ^dag_binding_type_int, + body: dag_mvp1_match_body_node() + ) } fn dag_mvp1_match_arrow_with_body_swapped_arms_node() -> Node { - Node { - kind: TypeNode { connective: Arrow }, - children: [ - Edge { - label: Positional, - target: dag_mvp1_pick_arrow_domain_conj_node() - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Named { name: ^arrow_body_edge }, - target: dag_mvp1_match_body_swapped_arms_node() - } - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_arrow_with_body_node( + domain: dag_mvp1_pick_arrow_domain_conj_node(), + return_type_binding: ^dag_binding_type_int, + body: dag_mvp1_match_body_swapped_arms_node() + ) } data dag_mvp1_match_if_body_fixture: Node = dag_mvp1_match_body_node() @@ -4610,28 +4412,11 @@ fn dag_mvp1_rec_construct_body_node() -> Node { } fn dag_mvp1_rec_arrow_with_body_node() -> Node { - Node { - kind: TypeNode { connective: Arrow }, - children: [ - Edge { - label: Positional, - target: dag_mvp1_pick_arrow_domain_conj_node() - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_rec) - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_rec) - }, - Edge { - label: Named { name: ^arrow_body_edge }, - target: dag_mvp1_rec_construct_body_node() - } - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_arrow_with_body_node( + domain: dag_mvp1_pick_arrow_domain_conj_node(), + return_type_binding: ^dag_binding_type_rec, + body: dag_mvp1_rec_construct_body_node() + ) } data dag_mvp1_rec_construct_body_fixture: Node = dag_mvp1_rec_construct_body_node() @@ -4673,28 +4458,11 @@ fn dag_mvp1_field_access_arrow_domain_conj_node() -> Node { } fn dag_mvp1_field_access_arrow_with_body_node() -> Node { - Node { - kind: TypeNode { connective: Arrow }, - children: [ - Edge { - label: Positional, - target: dag_mvp1_field_access_arrow_domain_conj_node() - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Named { name: ^arrow_body_edge }, - target: dag_mvp1_field_access_body_node() - } - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_arrow_with_body_node( + domain: dag_mvp1_field_access_arrow_domain_conj_node(), + return_type_binding: ^dag_binding_type_int, + body: dag_mvp1_field_access_body_node() + ) } data dag_mvp1_field_access_body_fixture: Node = dag_mvp1_field_access_body_node() @@ -4743,53 +4511,19 @@ fn dag_mvp1_bind_let_body_wrong_value_node() -> Node { } fn dag_mvp1_bind_arrow_with_body_node() -> Node { - Node { - kind: TypeNode { connective: Arrow }, - children: [ - Edge { - label: Positional, - target: dag_mvp1_pick_arrow_domain_conj_node() - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Named { name: ^arrow_body_edge }, - target: dag_mvp1_bind_let_body_node() - } - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_arrow_with_body_node( + domain: dag_mvp1_pick_arrow_domain_conj_node(), + return_type_binding: ^dag_binding_type_int, + body: dag_mvp1_bind_let_body_node() + ) } fn dag_mvp1_bind_arrow_with_body_wrong_value_node() -> Node { - Node { - kind: TypeNode { connective: Arrow }, - children: [ - Edge { - label: Positional, - target: dag_mvp1_pick_arrow_domain_conj_node() - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Positional, - target: dag_mvp1_type_atom_node(identity: ^dag_binding_type_int) - }, - Edge { - label: Named { name: ^arrow_body_edge }, - target: dag_mvp1_bind_let_body_wrong_value_node() - } - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_arrow_with_body_node( + domain: dag_mvp1_pick_arrow_domain_conj_node(), + return_type_binding: ^dag_binding_type_int, + body: dag_mvp1_bind_let_body_wrong_value_node() + ) } data dag_mvp1_bind_let_body_fixture: Node = dag_mvp1_bind_let_body_node() @@ -4827,29 +4561,10 @@ fn dag_grammar_terminal_for_mvp1_bind_token(token: ConcreteSyntaxToken) -> Gramm } fn dag_grammar_sequence_from_token_classes_bind() -> GrammarExpr { - match fold_list( - xs: dag_mvp1_bind_concrete_tokens(), - empty: DagGramBuild1StateInit, - cons: fn(state, token) { - match state { - DagGramBuild1StateInit => - DagGramBuild1StateReady { - expr: dag_grammar_terminal_for_mvp1_bind_token(token: token) - } - DagGramBuild1StateReady { expr: acc } => - DagGramBuild1StateReady { - expr: Sequence { - left: acc, - right: dag_grammar_terminal_for_mvp1_bind_token(token: token) - } - } - } - } - ) { - DagGramBuild1StateInit => - dag_grammar_terminal(token_class: ^dag_token_kw_fn) - DagGramBuild1StateReady { expr: result } => result - } + dag_grammar_sequence_from_concrete_tokens( + tokens: dag_mvp1_bind_concrete_tokens(), + terminal_for_token: dag_grammar_terminal_for_mvp1_bind_token + ) } fn dag_grammar_production_mvp1_fn_bind() -> GrammarProduction { @@ -5110,18 +4825,28 @@ fn dag_mvp1_bodied_fn_target_model( } } -fn dag_mvp1_pick_statement_prefix_tokens() -> List { +fn dag_mvp1_nullary_fn_statement_prefix_tokens( + fn_name_binding: Symbol, + return_type_binding: Symbol +) -> List { [ FixedToken { token_class: ^dag_token_kw_fn }, - BoundToken { token_class: ^dag_token_ident, binding: ^dag_binding_fn_one_or_two }, + BoundToken { token_class: ^dag_token_ident, binding: fn_name_binding }, FixedToken { token_class: ^dag_token_lparen }, FixedToken { token_class: ^dag_token_rparen }, FixedToken { token_class: ^dag_token_arrow }, - BoundToken { token_class: ^dag_token_ident, binding: ^dag_binding_type_int }, + BoundToken { token_class: ^dag_token_ident, binding: return_type_binding }, FixedToken { token_class: ^dag_token_lbrace } ] } +fn dag_mvp1_pick_statement_prefix_tokens() -> List { + dag_mvp1_nullary_fn_statement_prefix_tokens( + fn_name_binding: ^dag_binding_fn_one_or_two, + return_type_binding: ^dag_binding_type_int + ) +} + fn dag_mvp1_pick_statement_suffix_tokens() -> List { [FixedToken { token_class: ^dag_token_rbrace }] } @@ -5134,139 +4859,51 @@ fn dag_mvp1_pick_bodied_arrow_statement_scaffold() -> TargetBodiedArrowStatement ) } -fn dag_mvp1_pick_grammar_relation_row_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^grammar_relation_field_production, - target: formal_production_to_node(production: dag_formal_production_mvp1_fn_pick()) - ), - dag_named_edge( - name: ^grammar_relation_field_emitted, - target: dag_mvp1_fixture_emitted_pick_fn - ), - dag_named_edge( - name: ^grammar_relation_field_tokens, - target: grammar_relation_tokens_node( - tokens: dag_mvp1_pick_concrete_tokens(), - token_to_node: dag_concrete_token_node - ) - ) - ], - occurrence_id: SyntheticOccurrence +fn dag_mvp1_pick_family_spec() -> DagMvp1BodiedFnFamilySpec { + DagMvp1BodiedFnFamilySpec { + inhabitant_field: ^dag_inhabitant_field_mvp1_pick_fn, + emitted_fn: dag_mvp1_fixture_emitted_pick_fn, + grammar_row: DagGrammarRelationRow { + production: dag_formal_production_mvp1_fn_pick(), + emitted: dag_mvp1_fixture_emitted_pick_fn, + tokens: dag_mvp1_pick_concrete_tokens() + }, + source_literal: ^dag_mvp1_pick_source_literal, + production_binding: ^dag_production_mvp1_fn_pick, + authority_source_text: dag_mvp1_pick_source_text, + relation_rule: ^dag_relation_rule_mvp1_fn_pick, + scaffold: dag_mvp1_pick_bodied_arrow_statement_scaffold() } } -fn dag_mvp1_pick_serialize_source_children() -> List { - list_append( - left: [ - dag_named_edge( - name: ^serialize_source_field_source_text, - target: dag_inhabitant_atom(id: ^dag_mvp1_pick_source_literal) - ), - dag_named_edge( - name: ^serialize_source_field_source_grammar, - target: dag_inhabitant_atom(id: ^dag_production_mvp1_fn_pick) - ) - ], - right: [ - dag_named_edge( - name: ^grammar_relation_field_tokens, - target: grammar_relation_tokens_node( - tokens: dag_mvp1_pick_concrete_tokens(), - token_to_node: dag_concrete_token_node - ) - ) - ] - ) +fn dag_mvp1_pick_grammar_relation_row_node() -> Node { + dag_mvp1_bodied_fn_grammar_relation_row_node(spec: dag_mvp1_pick_family_spec()) } fn dag_mvp1_pick_serialize_source_node() -> Node { - let _authority = dag_mvp1_pick_source_text - Node { - kind: TypeNode { connective: Conj }, - children: dag_mvp1_pick_serialize_source_children(), - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_serialize_source_node(spec: dag_mvp1_pick_family_spec()) } fn dag_mvp1_pick_translation_rules_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^dag_relation_rule_mvp1_fn_pick, - target: grammar_relation_row_attach_bodied_scaffold( - row: dag_mvp1_pick_grammar_relation_row_node(), - scaffold: dag_mvp1_pick_bodied_arrow_statement_scaffold() - ) - ) - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_translation_rules_node(spec: dag_mvp1_pick_family_spec()) } fn dag_mvp1_pick_target_model_bundle_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^target_model_edge_selection_policy, - target: dag_mvp1_selection_policy_node() - ), - dag_named_edge( - name: ^target_model_edge_declared_inhabitants, - target: dag_mvp1_pick_declared_inhabitants_root() - ), - dag_named_edge( - name: ^target_model_edge_translation_rules, - target: dag_mvp1_pick_translation_rules_node() - ), - dag_named_edge( - name: ^target_model_edge_serialize_source, - target: dag_mvp1_pick_serialize_source_node() - ), - dag_named_edge( - name: ^target_model_edge_fidelity_quotient, - target: dag_mvp1_fidelity_quotient_node() - ), - dag_named_edge( - name: ^target_model_edge_value_expression_projection, - target: value_expr_projection_bundle_node( - projection: dag_value_expression_projection() - ) - ), - dag_named_edge( - name: ^target_model_edge_operator_realizations, - target: dag_operator_realizations_catalog_node() - ) - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_target_model_bundle_node(spec: dag_mvp1_pick_family_spec()) } fn dag_mvp1_pick_target_model() -> TargetModel { - TargetModel { - bundle: dag_mvp1_pick_target_model_bundle_node(), - lex: dag_wave1_lex(), - binding_spellings: dag_mvp1_binding_spellings(), - token_class_emit_transforms: target_model_emit_transforms_empty, - authority_source_text: dag_mvp1_pick_source_text, - runtime_row: target_emit_host_runtime_row_unconfigured - } + dag_mvp1_bodied_fn_target_model( + spec: dag_mvp1_pick_family_spec(), + runtime_row: Present { value: target_emit_host_runtime_row_unconfigured } + ) } fn dag_mvp1_bind_statement_prefix_tokens() -> List { - [ - FixedToken { token_class: ^dag_token_kw_fn }, - BoundToken { token_class: ^dag_token_ident, binding: ^dag_binding_fn_one }, - FixedToken { token_class: ^dag_token_lparen }, - FixedToken { token_class: ^dag_token_rparen }, - FixedToken { token_class: ^dag_token_arrow }, - BoundToken { token_class: ^dag_token_ident, binding: ^dag_binding_type_int }, - FixedToken { token_class: ^dag_token_lbrace } - ] + dag_mvp1_nullary_fn_statement_prefix_tokens( + fn_name_binding: ^dag_binding_fn_one, + return_type_binding: ^dag_binding_type_int + ) } fn dag_mvp1_bind_bodied_arrow_statement_scaffold() -> TargetBodiedArrowStatementScaffold { @@ -5277,139 +4914,51 @@ fn dag_mvp1_bind_bodied_arrow_statement_scaffold() -> TargetBodiedArrowStatement ) } +fn dag_mvp1_bind_family_spec() -> DagMvp1BodiedFnFamilySpec { + DagMvp1BodiedFnFamilySpec { + inhabitant_field: ^dag_inhabitant_field_mvp1_bind_fn, + emitted_fn: dag_mvp1_fixture_emitted_bind_fn, + grammar_row: DagGrammarRelationRow { + production: dag_formal_production_mvp1_fn_bind(), + emitted: dag_mvp1_fixture_emitted_bind_fn, + tokens: dag_mvp1_bind_concrete_tokens() + }, + source_literal: ^dag_mvp1_bind_source_literal, + production_binding: ^dag_production_mvp1_fn_bind, + authority_source_text: dag_mvp1_bind_source_text, + relation_rule: ^dag_relation_rule_mvp1_fn_bind, + scaffold: dag_mvp1_bind_bodied_arrow_statement_scaffold() + } +} + fn dag_mvp1_bind_grammar_relation_row_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^grammar_relation_field_production, - target: formal_production_to_node(production: dag_formal_production_mvp1_fn_bind()) - ), - dag_named_edge( - name: ^grammar_relation_field_emitted, - target: dag_mvp1_fixture_emitted_bind_fn - ), - dag_named_edge( - name: ^grammar_relation_field_tokens, - target: grammar_relation_tokens_node( - tokens: dag_mvp1_bind_concrete_tokens(), - token_to_node: dag_concrete_token_node - ) - ) - ], - occurrence_id: SyntheticOccurrence - } -} - -fn dag_mvp1_bind_serialize_source_children() -> List { - list_append( - left: [ - dag_named_edge( - name: ^serialize_source_field_source_text, - target: dag_inhabitant_atom(id: ^dag_mvp1_bind_source_literal) - ), - dag_named_edge( - name: ^serialize_source_field_source_grammar, - target: dag_inhabitant_atom(id: ^dag_production_mvp1_fn_bind) - ) - ], - right: [ - dag_named_edge( - name: ^grammar_relation_field_tokens, - target: grammar_relation_tokens_node( - tokens: dag_mvp1_bind_concrete_tokens(), - token_to_node: dag_concrete_token_node - ) - ) - ] - ) + dag_mvp1_bodied_fn_grammar_relation_row_node(spec: dag_mvp1_bind_family_spec()) } fn dag_mvp1_bind_serialize_source_node() -> Node { - let _authority = dag_mvp1_bind_source_text - Node { - kind: TypeNode { connective: Conj }, - children: dag_mvp1_bind_serialize_source_children(), - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_serialize_source_node(spec: dag_mvp1_bind_family_spec()) } fn dag_mvp1_bind_translation_rules_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^dag_relation_rule_mvp1_fn_bind, - target: grammar_relation_row_attach_bodied_scaffold( - row: dag_mvp1_bind_grammar_relation_row_node(), - scaffold: dag_mvp1_bind_bodied_arrow_statement_scaffold() - ) - ) - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_translation_rules_node(spec: dag_mvp1_bind_family_spec()) } fn dag_mvp1_bind_target_model_bundle_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^target_model_edge_selection_policy, - target: dag_mvp1_selection_policy_node() - ), - dag_named_edge( - name: ^target_model_edge_declared_inhabitants, - target: dag_mvp1_bind_declared_inhabitants_root() - ), - dag_named_edge( - name: ^target_model_edge_translation_rules, - target: dag_mvp1_bind_translation_rules_node() - ), - dag_named_edge( - name: ^target_model_edge_serialize_source, - target: dag_mvp1_bind_serialize_source_node() - ), - dag_named_edge( - name: ^target_model_edge_fidelity_quotient, - target: dag_mvp1_fidelity_quotient_node() - ), - dag_named_edge( - name: ^target_model_edge_value_expression_projection, - target: value_expr_projection_bundle_node( - projection: dag_value_expression_projection() - ) - ), - dag_named_edge( - name: ^target_model_edge_operator_realizations, - target: dag_operator_realizations_catalog_node() - ) - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_target_model_bundle_node(spec: dag_mvp1_bind_family_spec()) } fn dag_mvp1_bind_target_model() -> TargetModel { - TargetModel { - bundle: dag_mvp1_bind_target_model_bundle_node(), - lex: dag_wave1_lex(), - binding_spellings: dag_mvp1_binding_spellings(), - token_class_emit_transforms: target_model_emit_transforms_empty, - authority_source_text: dag_mvp1_bind_source_text, - runtime_row: target_emit_host_runtime_row_unconfigured - } + dag_mvp1_bodied_fn_target_model( + spec: dag_mvp1_bind_family_spec(), + runtime_row: Present { value: target_emit_host_runtime_row_unconfigured } + ) } fn dag_mvp1_loop_statement_prefix_tokens() -> List { - [ - FixedToken { token_class: ^dag_token_kw_fn }, - BoundToken { token_class: ^dag_token_ident, binding: ^dag_binding_fn_one }, - FixedToken { token_class: ^dag_token_lparen }, - FixedToken { token_class: ^dag_token_rparen }, - FixedToken { token_class: ^dag_token_arrow }, - BoundToken { token_class: ^dag_token_ident, binding: ^dag_binding_type_int }, - FixedToken { token_class: ^dag_token_lbrace } - ] + dag_mvp1_nullary_fn_statement_prefix_tokens( + fn_name_binding: ^dag_binding_fn_one, + return_type_binding: ^dag_binding_type_int + ) } fn dag_mvp1_loop_bodied_arrow_statement_scaffold() -> TargetBodiedArrowStatementScaffold { @@ -5420,261 +4969,91 @@ fn dag_mvp1_loop_bodied_arrow_statement_scaffold() -> TargetBodiedArrowStatement ) } -fn dag_mvp1_loop_grammar_relation_row_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^grammar_relation_field_production, - target: formal_production_to_node(production: dag_formal_production_mvp1_fn_loop()) - ), - dag_named_edge( - name: ^grammar_relation_field_emitted, - target: dag_mvp1_fixture_emitted_loop_fn - ), - dag_named_edge( - name: ^grammar_relation_field_tokens, - target: grammar_relation_tokens_node( - tokens: dag_mvp1_loop_concrete_tokens(), - token_to_node: dag_concrete_token_node - ) - ) - ], - occurrence_id: SyntheticOccurrence +fn dag_mvp1_loop_family_spec() -> DagMvp1BodiedFnFamilySpec { + DagMvp1BodiedFnFamilySpec { + inhabitant_field: ^dag_inhabitant_field_mvp1_loop_fn, + emitted_fn: dag_mvp1_fixture_emitted_loop_fn, + grammar_row: DagGrammarRelationRow { + production: dag_formal_production_mvp1_fn_loop(), + emitted: dag_mvp1_fixture_emitted_loop_fn, + tokens: dag_mvp1_loop_concrete_tokens() + }, + source_literal: ^dag_mvp1_loop_source_literal, + production_binding: ^dag_production_mvp1_fn_loop, + authority_source_text: dag_mvp1_loop_source_text, + relation_rule: ^dag_relation_rule_mvp1_fn_loop, + scaffold: dag_mvp1_loop_bodied_arrow_statement_scaffold() } } -fn dag_mvp1_loop_serialize_source_children() -> List { - list_append( - left: [ - dag_named_edge( - name: ^serialize_source_field_source_text, - target: dag_inhabitant_atom(id: ^dag_mvp1_loop_source_literal) - ), - dag_named_edge( - name: ^serialize_source_field_source_grammar, - target: dag_inhabitant_atom(id: ^dag_production_mvp1_fn_loop) - ) - ], - right: [ - dag_named_edge( - name: ^grammar_relation_field_tokens, - target: grammar_relation_tokens_node( - tokens: dag_mvp1_loop_concrete_tokens(), - token_to_node: dag_concrete_token_node - ) - ) - ] - ) +fn dag_mvp1_loop_grammar_relation_row_node() -> Node { + dag_mvp1_bodied_fn_grammar_relation_row_node(spec: dag_mvp1_loop_family_spec()) } fn dag_mvp1_loop_serialize_source_node() -> Node { - let _authority = dag_mvp1_loop_source_text - Node { - kind: TypeNode { connective: Conj }, - children: dag_mvp1_loop_serialize_source_children(), - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_serialize_source_node(spec: dag_mvp1_loop_family_spec()) } fn dag_mvp1_loop_translation_rules_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^dag_relation_rule_mvp1_fn_loop, - target: grammar_relation_row_attach_bodied_scaffold( - row: dag_mvp1_loop_grammar_relation_row_node(), - scaffold: dag_mvp1_loop_bodied_arrow_statement_scaffold() - ) - ) - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_translation_rules_node(spec: dag_mvp1_loop_family_spec()) } fn dag_mvp1_loop_target_model_bundle_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^target_model_edge_selection_policy, - target: dag_mvp1_selection_policy_node() - ), - dag_named_edge( - name: ^target_model_edge_declared_inhabitants, - target: dag_mvp1_loop_declared_inhabitants_root() - ), - dag_named_edge( - name: ^target_model_edge_translation_rules, - target: dag_mvp1_loop_translation_rules_node() - ), - dag_named_edge( - name: ^target_model_edge_serialize_source, - target: dag_mvp1_loop_serialize_source_node() - ), - dag_named_edge( - name: ^target_model_edge_fidelity_quotient, - target: dag_mvp1_fidelity_quotient_node() - ), - dag_named_edge( - name: ^target_model_edge_value_expression_projection, - target: value_expr_projection_bundle_node( - projection: dag_value_expression_projection() - ) - ), - dag_named_edge( - name: ^target_model_edge_operator_realizations, - target: dag_operator_realizations_catalog_node() - ) - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_target_model_bundle_node(spec: dag_mvp1_loop_family_spec()) } fn dag_mvp1_loop_target_model() -> TargetModel { - TargetModel { - bundle: dag_mvp1_loop_target_model_bundle_node(), - lex: dag_wave1_lex(), - binding_spellings: dag_mvp1_binding_spellings(), - token_class_emit_transforms: target_model_emit_transforms_empty, - authority_source_text: dag_mvp1_loop_source_text, - runtime_row: target_emit_host_runtime_row_unconfigured - } + dag_mvp1_bodied_fn_target_model( + spec: dag_mvp1_loop_family_spec(), + runtime_row: Present { value: target_emit_host_runtime_row_unconfigured } + ) } -fn dag_mvp1_match_grammar_relation_row_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^grammar_relation_field_production, - target: formal_production_to_node(production: dag_formal_production_mvp1_fn_match()) - ), - dag_named_edge( - name: ^grammar_relation_field_emitted, - target: dag_mvp1_fixture_emitted_match_fn - ), - dag_named_edge( - name: ^grammar_relation_field_tokens, - target: grammar_relation_tokens_node( - tokens: dag_mvp1_match_concrete_tokens(), - token_to_node: dag_concrete_token_node - ) - ) - ], - occurrence_id: SyntheticOccurrence +fn dag_mvp1_match_family_spec() -> DagMvp1BodiedFnFamilySpec { + DagMvp1BodiedFnFamilySpec { + inhabitant_field: dag_inhabitant_field_mvp1_match_fn, + emitted_fn: dag_mvp1_fixture_emitted_match_fn, + grammar_row: DagGrammarRelationRow { + production: dag_formal_production_mvp1_fn_match(), + emitted: dag_mvp1_fixture_emitted_match_fn, + tokens: dag_mvp1_match_concrete_tokens() + }, + source_literal: ^dag_mvp1_match_source_literal, + production_binding: ^dag_production_mvp1_fn_match, + authority_source_text: dag_mvp1_match_source_text, + relation_rule: ^dag_relation_rule_mvp1_fn_match, + scaffold: dag_mvp1_pick_bodied_arrow_statement_scaffold() } } -fn dag_mvp1_match_serialize_source_children() -> List { - list_append( - left: [ - dag_named_edge( - name: ^serialize_source_field_source_text, - target: dag_inhabitant_atom(id: ^dag_mvp1_match_source_literal) - ), - dag_named_edge( - name: ^serialize_source_field_source_grammar, - target: dag_inhabitant_atom(id: ^dag_production_mvp1_fn_match) - ) - ], - right: [ - dag_named_edge( - name: ^grammar_relation_field_tokens, - target: grammar_relation_tokens_node( - tokens: dag_mvp1_match_concrete_tokens(), - token_to_node: dag_concrete_token_node - ) - ) - ] - ) +fn dag_mvp1_match_grammar_relation_row_node() -> Node { + dag_mvp1_bodied_fn_grammar_relation_row_node(spec: dag_mvp1_match_family_spec()) } fn dag_mvp1_match_serialize_source_node() -> Node { - let _authority = dag_mvp1_match_source_text - Node { - kind: TypeNode { connective: Conj }, - children: dag_mvp1_match_serialize_source_children(), - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_serialize_source_node(spec: dag_mvp1_match_family_spec()) } fn dag_mvp1_match_translation_rules_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^dag_relation_rule_mvp1_fn_match, - target: grammar_relation_row_attach_bodied_scaffold( - row: dag_mvp1_match_grammar_relation_row_node(), - scaffold: dag_mvp1_pick_bodied_arrow_statement_scaffold() - ) - ) - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_translation_rules_node(spec: dag_mvp1_match_family_spec()) } fn dag_mvp1_match_target_model_bundle_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^target_model_edge_selection_policy, - target: dag_mvp1_selection_policy_node() - ), - dag_named_edge( - name: ^target_model_edge_declared_inhabitants, - target: dag_mvp1_match_declared_inhabitants_root() - ), - dag_named_edge( - name: ^target_model_edge_translation_rules, - target: dag_mvp1_match_translation_rules_node() - ), - dag_named_edge( - name: ^target_model_edge_serialize_source, - target: dag_mvp1_match_serialize_source_node() - ), - dag_named_edge( - name: ^target_model_edge_fidelity_quotient, - target: dag_mvp1_fidelity_quotient_node() - ), - dag_named_edge( - name: ^target_model_edge_value_expression_projection, - target: value_expr_projection_bundle_node( - projection: dag_value_expression_projection() - ) - ), - dag_named_edge( - name: ^target_model_edge_operator_realizations, - target: dag_operator_realizations_catalog_node() - ) - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_target_model_bundle_node(spec: dag_mvp1_match_family_spec()) } fn dag_mvp1_match_target_model() -> TargetModel { - TargetModel { - bundle: dag_mvp1_match_target_model_bundle_node(), - lex: dag_wave1_lex(), - binding_spellings: dag_mvp1_binding_spellings(), - token_class_emit_transforms: target_model_emit_transforms_empty, - authority_source_text: dag_mvp1_match_source_text - } + dag_mvp1_bodied_fn_target_model( + spec: dag_mvp1_match_family_spec(), + runtime_row: Absent + ) } fn dag_mvp1_rec_statement_prefix_tokens() -> List { - [ - FixedToken { token_class: ^dag_token_kw_fn }, - BoundToken { token_class: ^dag_token_ident, binding: ^dag_binding_fn_mk }, - FixedToken { token_class: ^dag_token_lparen }, - FixedToken { token_class: ^dag_token_rparen }, - FixedToken { token_class: ^dag_token_arrow }, - BoundToken { token_class: ^dag_token_ident, binding: ^dag_binding_type_rec }, - FixedToken { token_class: ^dag_token_lbrace } - ] + dag_mvp1_nullary_fn_statement_prefix_tokens( + fn_name_binding: ^dag_binding_fn_mk, + return_type_binding: ^dag_binding_type_rec + ) } fn dag_mvp1_rec_bodied_arrow_statement_scaffold() -> TargetBodiedArrowStatementScaffold { @@ -5685,126 +5064,44 @@ fn dag_mvp1_rec_bodied_arrow_statement_scaffold() -> TargetBodiedArrowStatementS ) } -fn dag_mvp1_rec_grammar_relation_row_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^grammar_relation_field_production, - target: formal_production_to_node(production: dag_formal_production_mvp1_fn_rec()) - ), - dag_named_edge( - name: ^grammar_relation_field_emitted, - target: dag_mvp1_fixture_emitted_rec_fn - ), - dag_named_edge( - name: ^grammar_relation_field_tokens, - target: grammar_relation_tokens_node( - tokens: dag_mvp1_rec_concrete_tokens(), - token_to_node: dag_concrete_token_node - ) - ) - ], - occurrence_id: SyntheticOccurrence +fn dag_mvp1_rec_family_spec() -> DagMvp1BodiedFnFamilySpec { + DagMvp1BodiedFnFamilySpec { + inhabitant_field: dag_inhabitant_field_mvp1_rec_fn, + emitted_fn: dag_mvp1_fixture_emitted_rec_fn, + grammar_row: DagGrammarRelationRow { + production: dag_formal_production_mvp1_fn_rec(), + emitted: dag_mvp1_fixture_emitted_rec_fn, + tokens: dag_mvp1_rec_concrete_tokens() + }, + source_literal: ^dag_mvp1_rec_source_literal, + production_binding: ^dag_production_mvp1_fn_rec, + authority_source_text: dag_mvp1_rec_source_text, + relation_rule: ^dag_relation_rule_mvp1_fn_rec, + scaffold: dag_mvp1_rec_bodied_arrow_statement_scaffold() } } -fn dag_mvp1_rec_serialize_source_children() -> List { - list_append( - left: [ - dag_named_edge( - name: ^serialize_source_field_source_text, - target: dag_inhabitant_atom(id: ^dag_mvp1_rec_source_literal) - ), - dag_named_edge( - name: ^serialize_source_field_source_grammar, - target: dag_inhabitant_atom(id: ^dag_production_mvp1_fn_rec) - ) - ], - right: [ - dag_named_edge( - name: ^grammar_relation_field_tokens, - target: grammar_relation_tokens_node( - tokens: dag_mvp1_rec_concrete_tokens(), - token_to_node: dag_concrete_token_node - ) - ) - ] - ) +fn dag_mvp1_rec_grammar_relation_row_node() -> Node { + dag_mvp1_bodied_fn_grammar_relation_row_node(spec: dag_mvp1_rec_family_spec()) } fn dag_mvp1_rec_serialize_source_node() -> Node { - let _authority = dag_mvp1_rec_source_text - Node { - kind: TypeNode { connective: Conj }, - children: dag_mvp1_rec_serialize_source_children(), - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_serialize_source_node(spec: dag_mvp1_rec_family_spec()) } fn dag_mvp1_rec_translation_rules_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^dag_relation_rule_mvp1_fn_rec, - target: grammar_relation_row_attach_bodied_scaffold( - row: dag_mvp1_rec_grammar_relation_row_node(), - scaffold: dag_mvp1_rec_bodied_arrow_statement_scaffold() - ) - ) - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_translation_rules_node(spec: dag_mvp1_rec_family_spec()) } fn dag_mvp1_rec_target_model_bundle_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^target_model_edge_selection_policy, - target: dag_mvp1_selection_policy_node() - ), - dag_named_edge( - name: ^target_model_edge_declared_inhabitants, - target: dag_mvp1_rec_declared_inhabitants_root() - ), - dag_named_edge( - name: ^target_model_edge_translation_rules, - target: dag_mvp1_rec_translation_rules_node() - ), - dag_named_edge( - name: ^target_model_edge_serialize_source, - target: dag_mvp1_rec_serialize_source_node() - ), - dag_named_edge( - name: ^target_model_edge_fidelity_quotient, - target: dag_mvp1_fidelity_quotient_node() - ), - dag_named_edge( - name: ^target_model_edge_value_expression_projection, - target: value_expr_projection_bundle_node( - projection: dag_value_expression_projection() - ) - ), - dag_named_edge( - name: ^target_model_edge_operator_realizations, - target: dag_operator_realizations_catalog_node() - ) - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_target_model_bundle_node(spec: dag_mvp1_rec_family_spec()) } fn dag_mvp1_rec_target_model() -> TargetModel { - TargetModel { - bundle: dag_mvp1_rec_target_model_bundle_node(), - lex: dag_wave1_lex(), - binding_spellings: dag_mvp1_binding_spellings(), - token_class_emit_transforms: target_model_emit_transforms_empty, - authority_source_text: dag_mvp1_rec_source_text - } + dag_mvp1_bodied_fn_target_model( + spec: dag_mvp1_rec_family_spec(), + runtime_row: Absent + ) } fn dag_mvp1_field_access_statement_prefix_tokens() -> List { @@ -5830,126 +5127,44 @@ fn dag_mvp1_field_access_bodied_arrow_statement_scaffold() -> TargetBodiedArrowS ) } -fn dag_mvp1_field_access_grammar_relation_row_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^grammar_relation_field_production, - target: formal_production_to_node(production: dag_formal_production_mvp1_fn_field_access()) - ), - dag_named_edge( - name: ^grammar_relation_field_emitted, - target: dag_mvp1_fixture_emitted_field_access_fn - ), - dag_named_edge( - name: ^grammar_relation_field_tokens, - target: grammar_relation_tokens_node( - tokens: dag_mvp1_field_access_concrete_tokens(), - token_to_node: dag_concrete_token_node - ) - ) - ], - occurrence_id: SyntheticOccurrence +fn dag_mvp1_field_access_family_spec() -> DagMvp1BodiedFnFamilySpec { + DagMvp1BodiedFnFamilySpec { + inhabitant_field: dag_inhabitant_field_mvp1_field_access_fn, + emitted_fn: dag_mvp1_fixture_emitted_field_access_fn, + grammar_row: DagGrammarRelationRow { + production: dag_formal_production_mvp1_fn_field_access(), + emitted: dag_mvp1_fixture_emitted_field_access_fn, + tokens: dag_mvp1_field_access_concrete_tokens() + }, + source_literal: ^dag_mvp1_field_access_source_literal, + production_binding: ^dag_production_mvp1_fn_field_access, + authority_source_text: dag_mvp1_field_access_source_text, + relation_rule: ^dag_relation_rule_mvp1_fn_field_access, + scaffold: dag_mvp1_field_access_bodied_arrow_statement_scaffold() } } -fn dag_mvp1_field_access_serialize_source_children() -> List { - list_append( - left: [ - dag_named_edge( - name: ^serialize_source_field_source_text, - target: dag_inhabitant_atom(id: ^dag_mvp1_field_access_source_literal) - ), - dag_named_edge( - name: ^serialize_source_field_source_grammar, - target: dag_inhabitant_atom(id: ^dag_production_mvp1_fn_field_access) - ) - ], - right: [ - dag_named_edge( - name: ^grammar_relation_field_tokens, - target: grammar_relation_tokens_node( - tokens: dag_mvp1_field_access_concrete_tokens(), - token_to_node: dag_concrete_token_node - ) - ) - ] - ) +fn dag_mvp1_field_access_grammar_relation_row_node() -> Node { + dag_mvp1_bodied_fn_grammar_relation_row_node(spec: dag_mvp1_field_access_family_spec()) } fn dag_mvp1_field_access_serialize_source_node() -> Node { - let _authority = dag_mvp1_field_access_source_text - Node { - kind: TypeNode { connective: Conj }, - children: dag_mvp1_field_access_serialize_source_children(), - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_serialize_source_node(spec: dag_mvp1_field_access_family_spec()) } fn dag_mvp1_field_access_translation_rules_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^dag_relation_rule_mvp1_fn_field_access, - target: grammar_relation_row_attach_bodied_scaffold( - row: dag_mvp1_field_access_grammar_relation_row_node(), - scaffold: dag_mvp1_field_access_bodied_arrow_statement_scaffold() - ) - ) - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_translation_rules_node(spec: dag_mvp1_field_access_family_spec()) } fn dag_mvp1_field_access_target_model_bundle_node() -> Node { - Node { - kind: TypeNode { connective: Conj }, - children: [ - dag_named_edge( - name: ^target_model_edge_selection_policy, - target: dag_mvp1_selection_policy_node() - ), - dag_named_edge( - name: ^target_model_edge_declared_inhabitants, - target: dag_mvp1_field_access_declared_inhabitants_root() - ), - dag_named_edge( - name: ^target_model_edge_translation_rules, - target: dag_mvp1_field_access_translation_rules_node() - ), - dag_named_edge( - name: ^target_model_edge_serialize_source, - target: dag_mvp1_field_access_serialize_source_node() - ), - dag_named_edge( - name: ^target_model_edge_fidelity_quotient, - target: dag_mvp1_fidelity_quotient_node() - ), - dag_named_edge( - name: ^target_model_edge_value_expression_projection, - target: value_expr_projection_bundle_node( - projection: dag_value_expression_projection() - ) - ), - dag_named_edge( - name: ^target_model_edge_operator_realizations, - target: dag_operator_realizations_catalog_node() - ) - ], - occurrence_id: SyntheticOccurrence - } + dag_mvp1_bodied_fn_target_model_bundle_node(spec: dag_mvp1_field_access_family_spec()) } fn dag_mvp1_field_access_target_model() -> TargetModel { - TargetModel { - bundle: dag_mvp1_field_access_target_model_bundle_node(), - lex: dag_wave1_lex(), - binding_spellings: dag_mvp1_binding_spellings(), - token_class_emit_transforms: target_model_emit_transforms_empty, - authority_source_text: dag_mvp1_field_access_source_text - } + dag_mvp1_bodied_fn_target_model( + spec: dag_mvp1_field_access_family_spec(), + runtime_row: Absent + ) } fn dag_mvp1_target_model() -> TargetModel { From 2960e60c1c0518018b84b706b4b5e5c65a016e8c Mon Sep 17 00:00:00 2001 From: "gunbai-bot[bot]" <289086189+gunbai-bot[bot]@users.noreply.github.com> Date: Mon, 6 Jul 2026 13:38:51 -0400 Subject: [PATCH 4/5] Demand-driven realize: typecheck as memoized recursion over import edges (byte-identical, width=1) (#6306) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * WIP: ci timeout investigation * trace_mark: stage-boundary gantt marks through the v1 compile pipeline One new registry intrinsic trace_mark(label) -> Unit (the record_source_chars_index_lookup precedent: registry row in 04_method.dag, realization in runtime_rust.dag -> v1_rt, interpreter arm for totality). Nine marks at the known segment boundaries of the compile pipeline (frontend/normalize/reconcile/analyses/emit begin+done, dag collect/serialize), so every run log carries a natural Gantt: [gantt] compile.reconcile.done t_ms=... rss_mib=... Consecutive marks define the segments; rss_mib rides along for the memory curve. Motivation: the whole-tree compile runs >60 min single-threaded with zero output after "resolved N sources" — CI runs die inside it blind (operator request 2026-07-05: checkpoints + a general logging system). Marked bridge, interim by design: dissolves into the v2 per-RealizedStep CostAccount (std.realization_measurement) when the realization-measurement carrier is inhabited. Authority edits (.dag) land with hand-synced generated seed (.rs) per the #5867 precedent — regen is currently blocked on main (#6291); re-verify at the next regen window. Co-Authored-By: Claude Fable 5 * WIP: ci timeout investigation * WIP: ci timeout investigation * WIP: ci timeout investigation * WIP: ci timeout investigation * WIP: ci timeout investigation * WIP: ci timeout investigation --------- Co-authored-by: Brian Searls Co-authored-by: Claude Fable 5 --- src/v1/04_infer.dag | 106 ++++++++----- src/v1/stage0/src/v1_compiler_infer.rs | 200 ++++++++++++++++--------- 2 files changed, 197 insertions(+), 109 deletions(-) diff --git a/src/v1/04_infer.dag b/src/v1/04_infer.dag index 762af8b0b8e..6c183f8ee01 100644 --- a/src/v1/04_infer.dag +++ b/src/v1/04_infer.dag @@ -6556,55 +6556,85 @@ fn seed_kernel_intern_table(intern_table: InternTable) -> InternTable { fold(map_keys(compiler_recursive_types), init: intern_table, f: (t, name) => intern(table: t, s: name).table) } +type RealizeState { + module_index: Map + variant_surfaces: Map + item_registry: Map + diags_by_name: Map> +} + fn typecheck(graph: ModuleGraph, source_indices: Map, intern_table: InternTable) -> TypedGraph { let intern_table = seed_kernel_intern_table(intern_table: intern_table) - typecheck_modules( - remaining: graph.modules, - modules: [], + let resolved_by_name = graph.modules |> fold(init: empty_map(), f: (acc, rm) => + map_insert(acc, authored_name_at(source_indices: source_indices, node: rm.module), rm) + ) + let state = graph.modules |> fold(init: RealizeState { module_index: empty_map(), variant_surfaces: empty_map(), item_registry: empty_map(), - diag_chunks: [], - source_indices: source_indices, - intern_table: intern_table + diags_by_name: empty_map() + }, f: (st, rm) => + realize_module( + name: authored_name_at(source_indices: source_indices, node: rm.module), + resolved_by_name: resolved_by_name, + state: st, + source_indices: source_indices, + intern_table: intern_table + ) + ) + let modules = graph.modules |> flat_map(rm => + match map_get(state.module_index, authored_name_at(source_indices: source_indices, node: rm.module)) { + Present { value: typed } => [typed] + Absent => [] + } + ) + let diag_chunks = graph.modules |> map(rm => + match map_get(state.diags_by_name, authored_name_at(source_indices: source_indices, node: rm.module)) { + Present { value: d } => d + Absent => [] + } ) + let expanded_registry = expand_transitive_services(modules: modules, registry: state.item_registry, remaining_passes: 5) + TypedGraph { modules: modules, item_registry: expanded_registry, diagnostics: flat_map(diag_chunks, c => c) } } -fn typecheck_modules( - remaining: List, - modules: List, - module_index: Map, - variant_surfaces: Map, - item_registry: Map, - diag_chunks: List>, +fn realize_module( + name: String, + resolved_by_name: Map, + state: RealizeState, source_indices: Map, intern_table: InternTable -) -> TypedGraph { - match remaining |> first { +) -> RealizeState { + match map_get(state.module_index, name) { + Present { value: _ } => state Absent => - let expanded_registry = expand_transitive_services(modules: modules, registry: item_registry, remaining_passes: 5) - TypedGraph { modules: modules, item_registry: expanded_registry, diagnostics: flat_map(diag_chunks, c => c) } - Present { value: resolved } => - let parent_result = collect_parent_envs(resolved: resolved, module_index: module_index, source_indices: source_indices) - let tc_result = typecheck_module(resolved: resolved, parent_index: module_index, variant_surfaces: variant_surfaces, source_indices: source_indices, intern_table: intern_table) - let typed = tc_result.typed - let tc_diags = tc_result.diagnostics - let typed_path = authored_name_at(source_indices: source_indices, node: typed.module) - let variant_surfaces = map_insert( - variant_surfaces, - typed_path, - build_variant_export_surface(tm: typed, surfaces: variant_surfaces, source_indices: source_indices) - ) - typecheck_modules( - remaining: remaining |> skip(1), - modules: list_push(modules, typed), - module_index: map_insert(module_index, typed_path, typed), - variant_surfaces: variant_surfaces, - item_registry: map_merge(item_registry, typed.item_registry), - diag_chunks: list_push(list_push(diag_chunks, parent_result.diagnostics), tc_diags), - source_indices: source_indices, - intern_table: intern_table - ) + match map_get(resolved_by_name, name) { + Absent => state + Present { value: resolved } => + let dep_state = resolved.resolved_imports |> fold(init: state, f: (st, imp) => + realize_module( + name: imp.module_path, + resolved_by_name: resolved_by_name, + state: st, + source_indices: source_indices, + intern_table: intern_table + ) + ) + let parent_result = collect_parent_envs(resolved: resolved, module_index: dep_state.module_index, source_indices: source_indices) + let tc_result = typecheck_module(resolved: resolved, parent_index: dep_state.module_index, variant_surfaces: dep_state.variant_surfaces, source_indices: source_indices, intern_table: intern_table) + let typed = tc_result.typed + let typed_path = authored_name_at(source_indices: source_indices, node: typed.module) + RealizeState { + module_index: map_insert(dep_state.module_index, typed_path, typed), + variant_surfaces: map_insert( + dep_state.variant_surfaces, + typed_path, + build_variant_export_surface(tm: typed, surfaces: dep_state.variant_surfaces, source_indices: source_indices) + ), + item_registry: map_merge(dep_state.item_registry, typed.item_registry), + diags_by_name: map_insert(dep_state.diags_by_name, typed_path, concat(parent_result.diagnostics, tc_result.diagnostics)) + } + } } } diff --git a/src/v1/stage0/src/v1_compiler_infer.rs b/src/v1/stage0/src/v1_compiler_infer.rs index f2d74e5f5d5..69065b75914 100644 --- a/src/v1/stage0/src/v1_compiler_infer.rs +++ b/src/v1/stage0/src/v1_compiler_infer.rs @@ -14737,6 +14737,14 @@ pub fn seed_kernel_intern_table(intern_table: Rc) -> Rc>>, + pub variant_surfaces: Rc>>, + pub item_registry: Rc>>, + pub diags_by_name: Rc>>>>, +} + pub fn typecheck( graph: Rc, source_indices: Rc>>, @@ -14744,95 +14752,145 @@ pub fn typecheck( ) -> Rc { { let intern_table = seed_kernel_intern_table(intern_table.clone()); - typecheck_modules( - graph.modules.clone(), - Rc::new(vec![]), - v1_rt::rc_empty_map::>(), - v1_rt::rc_empty_map::>(), - v1_rt::rc_empty_map::>(), - Rc::new(vec![]), - source_indices, - intern_table.clone(), - ) + let resolved_by_name = graph.modules.clone().iter().cloned().fold( + v1_rt::rc_empty_map::>(), + |acc: Rc>>, rm: Rc| { + v1_rt::rc_map_insert( + acc, + authored_name_at(source_indices.clone(), rm.module.clone()), + rm.clone(), + ) + }, + ); + let state = graph.modules.clone().iter().cloned().fold( + Rc::new(RealizeState { + module_index: v1_rt::rc_empty_map::>(), + variant_surfaces: v1_rt::rc_empty_map::>(), + item_registry: v1_rt::rc_empty_map::>(), + diags_by_name: v1_rt::rc_empty_map::>>>(), + }), + |st: Rc, rm: Rc| { + realize_module( + authored_name_at(source_indices.clone(), rm.module.clone()), + resolved_by_name.clone(), + st, + source_indices.clone(), + intern_table.clone(), + ) + }, + ); + let modules = Rc::new({ + let mut __result: Vec> = Vec::new(); + for rm in graph.modules.clone().iter().cloned() { + match v1_rt::map_get( + &state.module_index, + authored_name_at(source_indices.clone(), rm.module.clone()), + ) { + Some(typed) => __result.push(typed.clone()), + None => {} + } + } + __result + }); + let diag_chunks = Rc::new({ + let mut __result: Vec>>> = Vec::new(); + for rm in graph.modules.clone().iter().cloned() { + __result.push( + match v1_rt::map_get( + &state.diags_by_name, + authored_name_at(source_indices.clone(), rm.module.clone()), + ) { + Some(d) => d.clone(), + None => Rc::new(vec![]), + }, + ); + } + __result + }); + let expanded_registry = + expand_transitive_services(modules.clone(), state.item_registry.clone(), 5); + Rc::new(TypedGraph { + modules: modules.clone(), + item_registry: expanded_registry, + diagnostics: Rc::new({ + let mut __result = Vec::new(); + for c in diag_chunks.iter().cloned() { + __result.extend((*c.clone()).iter().cloned()); + } + __result + }), + }) } } -pub fn typecheck_modules( - mut remaining: Rc>>, - mut modules: Rc>>, - mut module_index: Rc>>, - mut variant_surfaces: Rc>>, - mut item_registry: Rc>>, - mut diag_chunks: Rc>>>>, - mut source_indices: Rc>>, - mut intern_table: Rc, -) -> Rc { - loop { - match remaining.clone().first().cloned() { - None => { - let expanded_registry = - expand_transitive_services(modules.clone(), item_registry, 5); - break Rc::new(TypedGraph { - modules: modules.clone(), - item_registry: expanded_registry, - diagnostics: Rc::new({ - let mut __result = Vec::new(); - for c in diag_chunks.iter().cloned() { - __result.extend((*c.clone()).iter().cloned()); - } - __result - }), - }); - } +pub fn realize_module( + name: String, + resolved_by_name: Rc>>, + state: Rc, + source_indices: Rc>>, + intern_table: Rc, +) -> Rc { + match v1_rt::map_get(&state.module_index, name.clone()) { + Some(_) => state, + None => match v1_rt::map_get(&resolved_by_name, name.clone()) { + None => state, Some(resolved) => { + let dep_state = resolved.resolved_imports.clone().iter().cloned().fold( + state.clone(), + |st: Rc, imp: Rc| { + realize_module( + imp.module_path.clone(), + resolved_by_name.clone(), + st, + source_indices.clone(), + intern_table.clone(), + ) + }, + ); let parent_result = collect_parent_envs( resolved.clone(), - module_index.clone(), + dep_state.module_index.clone(), source_indices.clone(), ); let tc_result = typecheck_module( resolved.clone(), - module_index.clone(), - variant_surfaces.clone(), + dep_state.module_index.clone(), + dep_state.variant_surfaces.clone(), source_indices.clone(), intern_table.clone(), ); let typed = tc_result.typed.clone(); - let tc_diags = tc_result.diagnostics.clone(); let typed_path = authored_name_at(source_indices.clone(), typed.module.clone()); - variant_surfaces = v1_rt::rc_map_insert( - variant_surfaces.clone(), - typed_path.clone(), - build_variant_export_surface( + Rc::new(RealizeState { + module_index: v1_rt::rc_map_insert( + dep_state.module_index.clone(), + typed_path.clone(), typed.clone(), - variant_surfaces.clone(), - source_indices.clone(), ), - ); - { - let __tco_0 = Rc::new( - remaining - .iter() - .cloned() - .skip(1 as usize) - .collect::>(), - ); - let __tco_1 = v1_rt::rc_list_push(modules, typed.clone()); - let __tco_2 = v1_rt::rc_map_insert(module_index, typed_path, typed.clone()); - let __tco_3 = v1_rt::rc_map_merge(item_registry, typed.item_registry.clone()); - let __tco_4 = v1_rt::rc_list_push( - v1_rt::rc_list_push(diag_chunks, parent_result.diagnostics.clone()), - tc_diags, - ); - remaining = __tco_0; - modules = __tco_1; - module_index = __tco_2; - item_registry = __tco_3; - diag_chunks = __tco_4; - continue; - } + variant_surfaces: v1_rt::rc_map_insert( + dep_state.variant_surfaces.clone(), + typed_path.clone(), + build_variant_export_surface( + typed.clone(), + dep_state.variant_surfaces.clone(), + source_indices.clone(), + ), + ), + item_registry: v1_rt::rc_map_merge( + dep_state.item_registry.clone(), + typed.item_registry.clone(), + ), + diags_by_name: v1_rt::rc_map_insert( + dep_state.diags_by_name.clone(), + typed_path.clone(), + v1_rt::concat( + parent_result.diagnostics.clone(), + tc_result.diagnostics.clone(), + ), + ), + }) } - } + }, } } From 97258c2f0892f7a33f404d127915a778920014e0 Mon Sep 17 00:00:00 2001 From: "gunbai-bot[bot]" <289086189+gunbai-bot[bot]@users.noreply.github.com> Date: Mon, 6 Jul 2026 13:40:02 -0400 Subject: [PATCH 5/5] Delete flaky test disposition_kernel_aligns_on_discriminator_fixture (#6324) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This sole test in mod floor_disposition_kernel_alignment (cli_run.rs) ran the floor-disposition analysis, which typechecks the gunbc module closure live — and that hits the #6239 compile-wall: per-module typecheck attribution measured gunbc.ci_deploy_access at 416s (7 min) for a single module, with the test spending >9 min and never finishing. It was the sole reason `cargo test --workspace` appeared to hang (deterministic, single-threaded reproducible), compounded by its std::env::set_current_dir cwd-mutation racing under parallel execution (#5971 class). No value and slated for deletion (operator, 2026-07-06). Floor-disposition coverage is exercised in the floor; the real fix is the compile-wall itself (owned elsewhere). Co-authored-by: Brian Searls Co-authored-by: Claude Opus 4.8 (1M context) --- src/v1/stage0/src/cli_run.rs | 298 ----------------------------------- 1 file changed, 298 deletions(-) diff --git a/src/v1/stage0/src/cli_run.rs b/src/v1/stage0/src/cli_run.rs index 4efc3ff1407..b8ede41fc51 100644 --- a/src/v1/stage0/src/cli_run.rs +++ b/src/v1/stage0/src/cli_run.rs @@ -6094,304 +6094,6 @@ new file mode 100644 } } -#[cfg(test)] -mod floor_disposition_kernel_alignment { - use super::{ - build_multi_entry_index, diff_file_matches_entry, entry_touches_rerun_frontier, - floor_diff_edits_from_diff_text, list_value_from_vec, make_eval_context, - rerun_frontier_nodes_for_entry, resolve_entry_with_index, DiscoveryRow, - }; - use crate::v1_interpreter::{self, ExecutionMode, Value}; - use std::path::PathBuf; - - const FIXTURE_REL: &str = "src/v2/test/fixture/floor_skip/node_precise_discriminator_test.dag"; - const FLOOR_RUNNER_TEST: &str = "src/v2/workflow/affected_set_floor_runner_test.dag"; - - fn workspace_root() -> PathBuf { - PathBuf::from(env!("CARGO_MANIFEST_DIR")) - .ancestors() - .nth(3) - .expect("workspace root") - .to_path_buf() - } - - fn setup_roots(ws: &PathBuf) -> Vec { - vec![ - ws.join("src/v2").to_string_lossy().into_owned(), - ws.join("dag").to_string_lossy().into_owned(), - ] - } - - fn fixture_line(text: &str, needle: &str) -> i64 { - text.lines() - .position(|l| l.contains(needle)) - .map(|i| (i + 1) as i64) - .unwrap_or_else(|| panic!("fixture missing line containing `{needle}`")) - } - - fn unified_diff_for_line(rel_path: &str, line: i64) -> String { - format!( - "diff --git a/{rel_path} b/{rel_path}\n--- a/{rel_path}\n+++ b/{rel_path}\n@@ -{line},0 +{line},1 @@\n+// witness-a touch\n" - ) - } - - fn list_value_from_strings(items: &[String]) -> Value { - v1_interpreter::list_value( - items - .iter() - .map(|s| Value::Str(s.clone())) - .collect::>(), - ) - } - - fn call_floor_kernel_would_skip( - ctx: &v1_interpreter::InterpContext, - changed_paths: &[String], - frontier_nodes: &[Value], - touches_frontier: bool, - function_edited: bool, - entry_file_touched: bool, - ) -> Result { - if !ctx.item_registry.contains_key("floor_kernel_would_skip") { - return Err("floor_kernel_would_skip not in context".to_string()); - } - let args = [ - ( - Some("changed_paths".to_string()), - list_value_from_strings(changed_paths), - ), - ( - Some("frontier_nodes".to_string()), - v1_interpreter::list_value(frontier_nodes.to_vec()), - ), - ( - Some("touches_frontier".to_string()), - Value::Bool(touches_frontier), - ), - ( - Some("function_edited".to_string()), - Value::Bool(function_edited), - ), - ( - Some("entry_file_touched".to_string()), - Value::Bool(entry_file_touched), - ), - ]; - match v1_interpreter::run_in_context_with_args(ctx, "floor_kernel_would_skip", &args, true) - { - Ok(Value::Bool(b)) => Ok(b), - Ok(other) => Err(format!( - "floor_kernel_would_skip returned `{}`, expected Bool", - ctx.format_value(&other) - )), - Err(e) => Err(format!("floor_kernel_would_skip: {e}")), - } - } - - fn rust_row_would_skip(skip_enabled: bool, entry_touches: bool, function_edited: bool) -> bool { - skip_enabled && !entry_touches && !function_edited - } - - fn function_edited_for_row(edits: &super::FloorDiffEdits, row: &DiscoveryRow) -> bool { - edits - .edited_test_fns - .iter() - .any(|(file, func)| diff_file_matches_entry(file, &row.entry) && func == &row.function) - } - - fn entry_touches_from_edits( - entry_ctx: &v1_interpreter::InterpContext, - entry_path: &str, - edits: &super::FloorDiffEdits, - ) -> Result { - let frontier_nodes = rerun_frontier_nodes_for_entry(entry_ctx, entry_path, edits)?; - if frontier_nodes.is_empty() { - return Ok(false); - } - entry_touches_rerun_frontier(entry_ctx, &list_value_from_vec(frontier_nodes)) - } - - struct Scenario { - label: &'static str, - diff_line_needle: &'static str, - expect_node_frontier_fires: bool, - expect_function_edited_fires: bool, - } - - fn assert_disposition_kernel_alignment_for_scenario( - ws: &PathBuf, - scenario: &Scenario, - roster: &[DiscoveryRow], - ) { - let roots = setup_roots(ws); - let index = build_multi_entry_index(&roots); - let fixture_abs = ws.join(FIXTURE_REL).to_string_lossy().into_owned(); - let text = std::fs::read_to_string(ws.join(FIXTURE_REL)) - .expect("node_precise_discriminator fixture readable"); - let line = fixture_line(&text, scenario.diff_line_needle); - let diff = unified_diff_for_line(FIXTURE_REL, line); - let edits = floor_diff_edits_from_diff_text(&index, &diff) - .unwrap_or_else(|e| panic!("{}: diff edits failed: {e}", scenario.label)); - - let (graph, source_indices) = - resolve_entry_with_index(&index, &fixture_abs).expect("fixture resolves"); - let entry_ctx = make_eval_context(&graph, source_indices, ExecutionMode::Wet); - let entry_touches = entry_touches_from_edits(&entry_ctx, &fixture_abs, &edits) - .unwrap_or_else(|e| panic!("{}: entry touch check failed: {e}", scenario.label)); - - if scenario.expect_node_frontier_fires { - assert!( - entry_touches, - "{}: node-frontier axis must fire for this diff", - scenario.label - ); - } - if scenario.expect_function_edited_fires { - assert!( - edits - .edited_test_fns - .iter() - .any(|(_, name)| name == "floor_disc_witness_a_only_holds"), - "{}: function-edited axis must populate edited_test_fns (got {:?})", - scenario.label, - edits.edited_test_fns - ); - } - - let (runner_graph, runner_indices) = resolve_entry_with_index(&index, FLOOR_RUNNER_TEST) - .expect("floor runner test entry resolves"); - let runner_ctx = make_eval_context(&runner_graph, runner_indices, ExecutionMode::Wet); - let changed_paths = vec![FIXTURE_REL.to_string()]; - - let mut saw_node_frontier_run = false; - let mut saw_function_edited_run = false; - - for row in roster { - let function_edited = function_edited_for_row(&edits, row); - let rust_skip = rust_row_would_skip(true, entry_touches, function_edited); - let dag_skip = call_floor_kernel_would_skip( - &runner_ctx, - &changed_paths, - &[], - entry_touches, - function_edited, - false, - ) - .unwrap_or_else(|e| { - panic!( - "{}: dag floor_kernel_would_skip failed for {} ({}): {e}", - scenario.label, row.function, row.entry - ) - }); - assert_eq!( - rust_skip, dag_skip, - "{}: run/skip mismatch for {} ({}): rust_skip={rust_skip} dag_skip={dag_skip} \ - entry_touches={entry_touches} function_edited={function_edited}", - scenario.label, row.function, row.entry - ); - if !rust_skip && entry_touches { - saw_node_frontier_run = true; - } - if !rust_skip && function_edited { - saw_function_edited_run = true; - } - } - - if scenario.expect_node_frontier_fires { - assert!( - saw_node_frontier_run, - "{}: expected at least one witness to RUN via node-frontier axis", - scenario.label - ); - } - if scenario.expect_function_edited_fires { - assert!( - saw_function_edited_run, - "{}: expected at least one witness to RUN via function-edited axis", - scenario.label - ); - } - } - - #[test] - fn disposition_kernel_aligns_on_discriminator_fixture() { - let ws = workspace_root(); - std::env::set_current_dir(&ws).expect("chdir workspace"); - let fixture_abs = ws.join(FIXTURE_REL).to_string_lossy().into_owned(); - let roster = vec![ - DiscoveryRow { - label: "floor_disc_witness_a_only".into(), - entry: fixture_abs.clone(), - function: "floor_disc_witness_a_only_holds".into(), - }, - DiscoveryRow { - label: "floor_disc_witness_b_only".into(), - entry: fixture_abs.clone(), - function: "floor_disc_witness_b_only_holds".into(), - }, - DiscoveryRow { - label: "floor_disc_witness_transitive".into(), - entry: fixture_abs.clone(), - function: "floor_disc_witness_transitive_holds".into(), - }, - ]; - - assert_disposition_kernel_alignment_for_scenario( - &ws, - &Scenario { - label: "node-frontier (referenced data item C)", - diff_line_needle: "^floor_disc_node_c_symbol", - expect_node_frontier_fires: true, - expect_function_edited_fires: false, - }, - &roster, - ); - - assert_disposition_kernel_alignment_for_scenario( - &ws, - &Scenario { - label: "function-edited (witness A declaration)", - diff_line_needle: "test fn floor_disc_witness_a_only_holds", - expect_node_frontier_fires: false, - expect_function_edited_fires: true, - }, - &roster, - ); - - assert_disposition_kernel_alignment_for_scenario( - &ws, - &Scenario { - label: "orphan node (both axes false for transitive witness)", - diff_line_needle: "^floor_disc_orphan_symbol", - expect_node_frontier_fires: false, - expect_function_edited_fires: false, - }, - &roster, - ); - } - - #[test] - fn disposition_kernel_edits_populated_on_referenced_node_diff() { - let ws = workspace_root(); - std::env::set_current_dir(&ws).expect("chdir workspace"); - let roots = setup_roots(&ws); - let index = build_multi_entry_index(&roots); - let text = std::fs::read_to_string(ws.join(FIXTURE_REL)).expect("fixture readable"); - let line = fixture_line(&text, "^floor_disc_node_c_symbol"); - let diff = unified_diff_for_line(FIXTURE_REL, line); - let edits = floor_diff_edits_from_diff_text(&index, &diff) - .expect("edits from referenced-node diff"); - assert!( - !edits.overlapping_data_items.is_empty(), - "referenced-node diff must populate overlapping_data_items" - ); - assert!( - edits.edited_test_fns.is_empty(), - "data-item diff must not populate edited_test_fns" - ); - } -} - // Step 3 witness (a) PARTIAL — impl-vs-impl PROVE gate (#5994). // Stable floor witnesses use deterministic fixture unified diffs (same structured shape as CI // git diff parsing) so every checkout executes the proof — not branch-only origin/main...HEAD