Repository navigation
selfhost: Field DSL expansion on flowc, Python expander retired (#682) - #956
Merged
Merged
Conversation
This was referenced Sep 27, 2026
godofecht
added a commit
that referenced
this pull request
Sep 27, 2026
Same hunk as the flow-driver part of #956, so either branch rebases cleanly over the other. Without it no example with an import builds on the default host, and the no-Python run check needs some that do.
godofecht
force-pushed
the
port/selfhost-next
branch
from
September 27, 2026 21:19
f32f03d to
5f97a32
Compare
This was referenced Sep 27, 2026
Merged
compiler/src/field_dsl.flow is the whole of src/flow/field_dsl.py: detection, `field` / `boundary` / `evolves as laplacian` parsing, the diagnostics, helper generation and injection before main(). Each regex is a hand-written scan. Output is byte-identical to the Python expander, including its quirks (trailing newline dropped, a one-line boundary consuming the next line). Every flowc source read now expands the DSL before parse: the emit path in main.flow and driver.flow, and all four bundle passes in resolve.flow. FLOWC_EXPAND_ONLY=1 writes the expanded source instead of C. compiler/scripts/parity_field_dsl.sh holds flowc to goldens recorded from the Python expander (21 fixtures), checks that the 1995 other .flow files pass through untouched, can diff live against the Python at any git rev (--python), and compiles and runs examples/evolution/heat_diffusion.flow on flowc alone. The self-emit scripts build field_dsl as a new leaf frontend module.
src/flow/field_dsl.py keeps its two public functions for the Python host, the LSP and check_doc_examples.py, but expand_field_dsl now runs flowc with FLOWC_EXPAND_ONLY=1 (FLOWC_BIN, else flowc built with cc from the checked-in bootstrap C) and raises flowc's diagnostic as SyntaxError. The regex parser, FieldDecl and compile_fields are gone. The unit test asserts through the public API only, since parse_field_dsl no longer exists.
godofecht
force-pushed
the
port/selfhost-next
branch
from
September 27, 2026 21:43
5f97a32 to
18a7ba4
Compare
godofecht
added a commit
that referenced
this pull request
Sep 29, 2026
godofecht
added a commit
that referenced
this pull request
Sep 29, 2026
This was referenced Sep 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
field/boundary/evolves as laplacian(the Field DSL, #163) now expands inside flowc. The Python expander is gone.compiler/src/field_dsl.flow: the whole of the formersrc/flow/field_dsl.py. Detection, parsing, all ten diagnostics,T_field_stepgeneration and injection beforemain(). Each regex is a hand-written scan. Output is byte-identical to the Python, including its quirks.main.flowanddriver.flow, and all four bundle passes inresolve.flow.FLOWC_EXPAND_ONLY=1writes the expanded source.flow-driver: on the flowc host, a program with an import (or the Field DSL, which adds one) is bundled from the repository root. Programs with imports underexamples/andtests/langthat build on flowc go from 5 of 346 to 90, with none lost.src/flow/field_dsl.py: 234 lines down to a 60-line bridge that runs flowcFLOWC_EXPAND_ONLY=1for the Python host, LSP andcheck_doc_examples.py. Net Python: -178 lines.field_dslas a new leaf frontend module../flow compile examples/evolution/heat_diffusion.flownow builds and runs withpython3andpythonshimmed to exit 127. No call was logged.Parity
compiler/scripts/parity_field_dsl.sh(shell):21 fixtures (11 expansions, 10 errors) are checked against goldens recorded from the Python expander. Every other
.flowin the repo must pass through untouched.--python <rev>diffs live against the Python at any revision.Bootstrap
Regenerated last, in its own commit, following AGENTS.md. The fixed point holds,
bootstrap_from_c.sh --verifypasses, andself_host_full.shpasses (three generations, byte-identical). The Python-host self-test printsflowc: PASS.Known, not from this PR
roundtrip.shfails atcompile_module lexer, before any module touched here.lexer.flowusesKW_SHADERwithout importing it (from selfhost: port Shader DSL lexing, parsing and validation to Flow (#683) #890).flow runstill callspython3 -m flow.package syncfor every program.flow compileis Python-free. This is listed in python-in-flow.md.boundary T { ... }also consumes the next line. If that line opens a block, asfunction main() {does, the result is an error. Fixtureerr_swallow_mainrecords it.