Skip to content

feat(flowc): stmt attrs, generic structs, ref/slice types, export type - #445

Merged
godofecht merged 1 commit into
mainfrom
work
Aug 12, 2026
Merged

godofecht merged 1 commit into
mainfrom
work

Conversation

@godofecht

Copy link
Copy Markdown
Contributor

Summary

  • Statement-level attributes (@name, @name(args)) are now skipped before statements.
  • Generic struct declarations (struct Signal<R>) now parse (type params skipped).
  • Generic type arguments on identifiers in expressions (Signal<R> { ... }) are now skipped.
  • Reference types (&T) and slice types ([T]) are now parsed in the type parser.
  • extern "label" { ... } string-prefixed extern blocks are now handled.
  • export type and export distinct type declarations are now parsed.
  • Keywords (like unit) are now accepted as let variable names.

Context

bigint.flow uses @max_iterations(65536) on a while loop. rf.flow has export struct Signal<R> and export type IQ = c64. render3d.flow uses &[f32] parameter types. time.flow uses extern "jit" { ... }. ui_layout.flow has let unit: f32 = ... where unit is a keyword.

Test plan

  • ./flow run compiler/src/main.flow passes (flowc: PASS)
  • Three consecutive generation fixed-points pass (byte-identical)
  • Self-compile audit: all compiler/src modules pass
  • Roundtrip: bundle_tc_bad correctly fails (rc=1)
  • bigint, rf, render3d, time, ui_layout, concurrent now emit C

This pull request includes code written with the assistance of AI.
The code has not yet been reviewed by a human.

Generated with Devin

…eyword let names

compiler/src/parser.flow:
- Skip statement-level attributes (@name, @name(args)) before statements.
- Skip generic type parameters on struct names (struct Signal<R>).
- Skip generic type arguments on identifiers in expressions (Signal<R> { ... }).
- Parse reference types (&T) and slice types ([T]) in flowc_parse_type.
- Handle extern "label" { ... } string-prefixed extern blocks.
- Handle export type and export distinct type declarations.
- Allow keywords (e.g. unit) as let variable names.

lib/stdlib/bigint.flow now parses (uses @max_iterations on while).
lib/stdlib/rf.flow now parses (uses export struct Signal<R>, export type IQ).
lib/stdlib/render3d.flow now parses (uses &[f32] parameter types).
lib/stdlib/time.flow now parses (uses extern "jit" { ... }).
lib/stdlib/ui_layout.flow now parses (uses let unit: f32 = ...).
lib/stdlib/concurrent.flow now parses.

compiler/bootstrap/flowc_stage_a.c: regenerated.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@cursor

cursor Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@godofecht
godofecht merged commit 3e31380 into main Aug 12, 2026
15 checks passed
@godofecht
godofecht deleted the work branch August 12, 2026 05:52
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