Skip to content

feat: support line/block comments and the modulo operator - #7

Merged
AdamHameed merged 1 commit into
mainfrom
feature/comments-and-modulo
Jul 15, 2026
Merged

feat: support line/block comments and the modulo operator#7
AdamHameed merged 1 commit into
mainfrom
feature/comments-and-modulo

Conversation

@AdamHameed

Copy link
Copy Markdown
Owner

PR Description

Adds two small quality-of-life features on top of the newly merged function support:

  • Comments: the lexer now skips // line comments and /* ... */ block comments, and reports an error for unterminated block comments. (Resolves the lexer TODO.)
  • Modulo operator: new % token, BinaryOp::Modulo parsed at multiplicative precedence, lowered to LLVM srem.

Tests: 4 new lexer unit tests (line/block comments, unterminated-comment error, % tokenization) and 3 new e2e tests (modulo evaluation, precedence grouping, comments in a full program). Full suite: 27 unit + 27 e2e passing, clippy/fmt clean.

cc @hand-burger — follows on from your function-support stack (#1-#6), in case you want to build compound assignment (+=, %=) on top of this.

🤖 Generated with Claude Code

- Lexer skips // line comments and /* */ block comments, with an error
  for unterminated block comments
- New % token, BinaryOp::Modulo at multiplicative precedence, lowered
  to LLVM srem
- Unit tests for comment skipping and % tokenization; e2e tests for
  modulo evaluation, precedence, and comment handling

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@AdamHameed
AdamHameed merged commit f9ef68b into main Jul 15, 2026
1 check passed
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