Skip to content

feat(flowc): not keyword, keyword field names, extern function - #444

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

  • not keyword for logical negation, mapped to ! in the AST.
  • Keywords (like unit) are now accepted as struct field names.
  • extern function name(params) -> Ret declarations are now parsed (signature skipped, same as extern { ... } blocks).

Context

memory_simple.flow uses if not memory_check(...). ui_layout.flow has a struct field named unit. net.flow and posix.flow declare libc functions with extern function socket(...).

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)
  • if not true { return 1 } compiles and returns 0
  • net.flow, posix.flow, ui_layout.flow, memory_simple.flow 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

@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.

compiler/src/token.flow: add KW_NOT (30).

compiler/src/lexer.flow: recognize "not" keyword.

compiler/src/parser.flow:
- Handle `not` as unary negation (maps to TOK_BANG / !).
- Allow TOK_KEYWORD as struct field name (e.g. `unit: f32`).
- Add `extern function name(params) -> Ret` parsing (skip signature).
- Add flowc_parser_skip_paren_block helper.
- Add forward declarations for skip helpers.

lib/stdlib/memory_simple.flow now parses (uses `not`).
lib/stdlib/ui_layout.flow now parses (uses `unit` as field name).
lib/stdlib/net.flow and posix.flow now parse (use `extern function`).

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>
@godofecht
godofecht merged commit 4a612cf into main Aug 12, 2026
14 checks passed
@godofecht
godofecht deleted the work branch August 12, 2026 05:07
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