Skip to content

feat(flowc): semicolon and elif support in self-hosted parser - #433

Merged
godofecht merged 2 commits into
mainfrom
work
Aug 11, 2026
Merged

godofecht merged 2 commits into
mainfrom
work

Conversation

@godofecht

Copy link
Copy Markdown
Contributor

Summary

  • compiler/src/token.flow: add KW_ELIF keyword constant (25).
  • compiler/src/lexer.flow: classify elif as KW_ELIF in the keyword table.
  • compiler/src/parser.flow: skip semicolons in flowc_parse_block so semicolon-separated statements work. Handle if/elif/else chains by desugaring elif into nested if inside an else block. Add flowc_parse_if_chain helper for recursive elif chains.
  • compiler/src/main.flow: add test_parse_elif self-test verifying 2 if nodes, 4 returns, and 0 typecheck errors for a 3-branch if/elif/else program.

Context

The self-hosted compiler at compiler/src/ could parse its own source files and emit valid C, but two common Flow constructs were missing: semicolon-separated statements and elif chains. Both are used throughout the Flow standard library and examples.

Test plan

  • All 1341 Python unit tests pass
  • ./flow run compiler/src/main.flow passes (flowc: PASS, 34 tests including new elif test)
  • ./flow run compiler/src/test_parser.flow passes (test_parser: PASS)
  • Self-hosted compiler compiles a program with if/elif/else and ; and produces correct output

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

Generated with Devin

godofecht and others added 2 commits August 11, 2026 21:36
Webhooks are outbound only and cannot greet joining members by name.
Add a small discord.py bot that listens to guildMemberAdd with the
privileged GUILD_MEMBERS intent and posts a rotating welcome message
to #welcome mentioning the new member. Pure message logic lives in
welcome.py so it tests without the discord dependency.

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

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
compiler/src/token.flow: add KW_ELIF keyword constant (25).
compiler/src/lexer.flow: classify "elif" as KW_ELIF in the keyword
table.
compiler/src/parser.flow:
  - Import TOK_SEMI and skip semicolons in flowc_parse_block so
    semicolon-separated statements work.
  - Import KW_ELIF and handle if/elif/else chains by desugaring
    elif into nested if inside an else block. Add
    flowc_parse_if_chain helper for recursive elif chains.
compiler/src/main.flow: add test_parse_elif self-test verifying
2 if nodes, 4 returns, and 0 typecheck errors for a 3-branch
if/elif/else program.

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

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

cursor Bot commented Aug 11, 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 7c8249d into main Aug 11, 2026
14 of 15 checks passed
@godofecht
godofecht deleted the work branch August 11, 2026 21:25
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