Skip to content

feat: fan-in groups read graph inputs directly - #20

Merged
psyinf merged 1 commit into
mainfrom
feature/group-inputs
Sep 19, 2026
Merged

psyinf merged 1 commit into
mainfrom
feature/group-inputs

Conversation

@psyinf

@psyinf psyinf commented Sep 19, 2026

Copy link
Copy Markdown
Owner

Stacked on #19 (feature/to-ascii). Retarget to main once #17–#19 are merged.

Problem

A merge could not read a named graph input:

(plots: plots, ticks: in.ticks) -> GatedImmTracker -> tracks
2:25: expected an edge name in group but found '.'

The workaround was a pass-through stage to copy the input onto an ordinary edge. Plain in in a group was
parsed, but it was never registered as a graph input.

Change

  • Parse: both parsers (lexy and the deprecated handwritten one) accept an optional .key after a group edge,
    including after name:. They record each edge's key and location.
  • Build: buildStatement checks the group edges. in.<key> is spelled as its edge. x.key gets the usual
    ". only on in/out" diagnostic. out, out.<key> and end inside a group give "may only appear as the last
    term". Every in / in.<key> is registered through a new bindInput helper, the same one the single-source
    branch now uses, deduplicated by edge.
  • Types: wireMergeSlots now infers the type of an undeclared input read only by a merge slot from that
    slot's type. Before, such an input stayed untyped. Declared inputs are checked as before
    (slot 2 of 'X' expects ... but the graph input 'in.quotes' carries ...).
  • Docs and example: namedPipeline gets section 7, (greeting: in.greeting, name: proper) -> Greet, with its
    toAscii listing. README, EXAMPLE.md, CHANGELOG and the grammar comment in GraphLang.hpp describe the new form.

Tests

  • GraphInputsTests:
    • positional, named and mixed groups over named inputs
    • plain in in a group of a single-input graph
    • declared-type checks and "never reads" with group-only readers
    • type inferred from the slot, with std::invalid_argument on a wrong type
    • must-fail cases for msg.x, out, out.x
    • GraphProgram::inputs and the input's location
  • FilterGraphTests:
    • lexy and handwritten parsers agree on the new forms and diagnostics
    • toAscii roots a tree at a group-only input

All 124 tests pass locally (MSVC debug developer preset).

@psyinf
psyinf changed the base branch from feature/to-ascii to main September 19, 2026 21:05
A group entry may now be `in` or `in.<key>`, positional or named:
`(plots: plots, ticks: in.ticks) -> Tracker -> out`. Both parsers accept
the `.key`; buildStatement spells it `in.<key>`, registers the input in
GraphProgram::inputs like a single source does, and rejects `x.key`,
`out` and `end` inside a group. An undeclared input read only by a merge
slot takes the slot's type.

The namedPipeline example gets a section for it, and README, EXAMPLE.md
and CHANGELOG describe it.
@psyinf
psyinf force-pushed the feature/group-inputs branch from dcc13f5 to 32d2f52 Compare September 19, 2026 21:07
@psyinf
psyinf merged commit 01db206 into main Sep 19, 2026
3 checks passed
@psyinf
psyinf deleted the feature/group-inputs branch September 19, 2026 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant