Skip to content

flowc: parse every .flow file the Python parser accepts (1002 -> 2082) - #1001

Merged
godofecht merged 3 commits into
mainfrom
fix/flowc-parse-coverage
Sep 29, 2026
Merged

godofecht merged 3 commits into
mainfrom
fix/flowc-parse-coverage

Conversation

@godofecht

Copy link
Copy Markdown
Contributor

flowc now parses every tracked .flow file the Python parser accepts: 2082 of 2082, up from 1002 of 2072.

Measurement

  • FLOWC_PARSE_ONLY=1 with FLOWC_IN runs only the lexer and parser.
  • Parse errors report path:line:col and the offending token. The position is the first token that failed, where before it was the point where parsing stopped. This applies to emit, bundle and driver modes too.
  • compiler/scripts/parse_coverage.sh runs the parser over every tracked .flow file and prints counts by area and a histogram of failing tokens. The 179 files the Python parser also rejects are recorded once in compiler/parse_coverage/python_rejects.txt, so the gate needs no Python.
  • A new CI job, flowc parse coverage, runs --check against compiler/parse_coverage/floor.txt (2082).

Coverage by commit

step overall examples/verify lib/stdlib tests/lang
before 1002/2072 0/898 111/112 128/138
theorem, assume, therefore, claim refs 1919 895 111 128
flow blocks 1988 895 111 130
handle, ui layout, pipeline blocks 2023 895 111 131
let without init, unit, distinct, effect rows 2054 895 112 138
or-patterns, guards, nested patterns 2060 895 112 138
[T; N], capability types, ?, vector literals, soft names 2070 898 112 138
sort by, module 2072/2072 898/898 112/112 138/138
after rebase (10 new files upstream) 2082/2082 898/898 112/112 139/139

No silent miscompiles

Constructs that Stage-A cannot lower parse into parse-only AST kinds (80 to 95 in compiler/src/ast.flow, plus AST_HANDLE). cgen, jsgen, fmt and the typecheck entry refuse a program holding one with unsupported in Stage-A: <construct>.

Three forms are real lowerings:

  • let x: T with no initializer emits an uninitialized C local, as the Python host does.
  • unit and shader are no longer keywords, so they work as ordinary names.
  • import .a.b relative multi-segment paths now parse.

A differential emit over every tracked file shows the C from Stage-A is byte-identical to before for all 770 files the old compiler could emit. 13 more files now emit.

Verification

  • Python-host selftest: flowc: PASS
  • Bootstrap C regenerated last, in its own commit. The fixed point holds, and bootstrap_from_c.sh --verify, self_host_full.sh and roundtrip.sh all pass.
  • Bootstrap suite (tests/lang): 126 pass, 13 fail. It was 119 and 19, and no file regressed.
  • New test tests/lang/test_parser_python_forms.flow.
  • roundtrip.sh now expects the new diagnostic for match_unsupported.flow. The or-pattern parses and is refused, and no C is written.

Follow-ups

godofecht added a commit that referenced this pull request Sep 29, 2026
Rebased onto main containing #1003, #999, #998 and #989. Carries #1001's
parse-only mode, located parse errors (flowc_parser_print_error, which the
driver, emit and bundle paths now use), theorem/assume/therefore/claim
references, flow blocks, handle, ui layout and pipeline blocks, let without
initializer, contextual unit, distinct, effect rows, or-patterns, guards,
nested patterns, [T; N], capability types, ?, vector literals, soft names,
sort-by keys, entropy policies and module blocks, the parse coverage script
and its CI floor, and the Python-grammar parser contract test. The
#1001/#1003 reconciliation follows the one in #1012.
@godofecht
godofecht force-pushed the fix/flowc-parse-coverage branch from 1727c27 to 4f6e81d Compare September 29, 2026 07:24
godofecht added a commit that referenced this pull request Sep 29, 2026
Rebased onto main containing #1003, #999, #998 and #989. Carries #1001's
parse-only mode, located parse errors (flowc_parser_print_error, which the
driver, emit and bundle paths now use), theorem/assume/therefore/claim
references, flow blocks, handle, ui layout and pipeline blocks, let without
initializer, contextual unit, distinct, effect rows, or-patterns, guards,
nested patterns, [T; N], capability types, ?, vector literals, soft names,
sort-by keys, entropy policies and module blocks, the parse coverage script
and its CI floor, and the Python-grammar parser contract test. The
#1001/#1003 reconciliation follows the one in #1012.
@godofecht
godofecht force-pushed the fix/flowc-parse-coverage branch from 4f6e81d to 4ae3b13 Compare September 29, 2026 07:52
godofecht added a commit that referenced this pull request Sep 29, 2026
#1001 and #1003 both reworked parse diagnostics. With both merged the
located form from #1001 wins, and it now also prints the #1003 note when
the failing token is a keyword. roundtrip.sh's keyword_param check
expects the merged form.
Rebased onto main containing #1003, #999, #998 and #989. Carries #1001's
parse-only mode, located parse errors (flowc_parser_print_error, which the
driver, emit and bundle paths now use), theorem/assume/therefore/claim
references, flow blocks, handle, ui layout and pipeline blocks, let without
initializer, contextual unit, distinct, effect rows, or-patterns, guards,
nested patterns, [T; N], capability types, ?, vector literals, soft names,
sort-by keys, entropy policies and module blocks, the parse coverage script
and its CI floor, and the Python-grammar parser contract test. The
#1001/#1003 reconciliation follows the one in #1012.
#1001 and #1003 both reworked parse diagnostics. With both merged the
located form from #1001 wins, and it now also prints the #1003 note when
the failing token is a keyword. roundtrip.sh's keyword_param check
expects the merged form.
@godofecht
godofecht force-pushed the fix/flowc-parse-coverage branch from 4ae3b13 to a94abc3 Compare September 29, 2026 08:27
godofecht added a commit that referenced this pull request Sep 29, 2026
…ors as #1003 does

roundtrip.sh builds the frontend module by module, so proof_lower.flow
(called from cgen, jsgen and the typecheck) is compiled, given a header
and linked into flowc_frontend.o and flowc_jsgen_fmt.o.

driver.flow keeps #1003's flowc_parser_report where #1001 and #1003
both changed the same line; the roundtrip's keyword_param check (from
@godofecht
godofecht merged commit 8f74d78 into main Sep 29, 2026
26 checks passed
godofecht added a commit that referenced this pull request Sep 29, 2026
…ors as #1003 does

roundtrip.sh builds the frontend module by module, so proof_lower.flow
(called from cgen, jsgen and the typecheck) is compiled, given a header
and linked into flowc_frontend.o and flowc_jsgen_fmt.o.

driver.flow keeps #1003's flowc_parser_report where #1001 and #1003
both changed the same line; the roundtrip's keyword_param check (from
@godofecht
godofecht deleted the fix/flowc-parse-coverage branch October 1, 2026 12:49
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