Skip to content

feat(compiler): for-range loop for i in start..end (W60, R-CG-7) - #834

Merged
gHashTag merged 1 commit into
masterfrom
feat/wave-60/for-range-loop
May 30, 2026
Merged

gHashTag merged 1 commit into
masterfrom
feat/wave-60/for-range-loop

Conversation

@gHashTag

Copy link
Copy Markdown
Owner

Closes #833

Wave 60 (R-CG-7): Range-based for loop

What

  • for i in start..end { body } syntax
  • TokenKind::KwIn keyword, NodeKind::StmtForRange node
  • parse_range_bound helper avoids struct-literal Name{ } ambiguity (ident followed by { is not treated as struct literal in range context)
  • Codegen all 4 backends:
    • Verilog: for (i = start; i < end; i = i + 1) begin
    • C: for (int i = start; i < end; i++)
    • Rust: for i in start..end {
    • Zig: for (start..end) |i| {
  • Loop unroller extended for StmtForRange (unrolls constant ranges ≤ 4)
  • Old-style for (items) |x| { } still works unchanged
  • Rust codegen has_body check widened to include all statement types

Tests

9 new inline tests: parse, Verilog/C/Rust/Zig emit, nested for-range, expr bound (0..N), old-for compatibility, loop unroll. All pass. 825 total.

@github-actions

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-05-24 08:09:27 UTC

Summary

Status Count
Total Open PRs 21
PRs with Failing Checks 1
PRs with All Checks Green 20
READY 19
FAILING 1
PENDING 0

This was referenced May 24, 2026
Wave 60 (R-CG-7): TokenKind::KwIn, NodeKind::StmtForRange.
parse_range_bound helper avoids struct-literal ambiguity.
Verilog/C/Rust/Zig codegen. Loop unroller extended.
9 new tests, all pass. 825 total.
@gHashTag
gHashTag force-pushed the feat/wave-60/for-range-loop branch from c524959 to 9ea2866 Compare May 30, 2026 15:26
@gHashTag
gHashTag merged commit ff89f49 into master May 30, 2026
14 of 15 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-05-30 15:26:26 UTC

Summary

Status Count
Total Open PRs 38
PRs with Failing Checks 38
PRs with All Checks Green 0
READY 0
FAILING 38
PENDING 0

gHashTag added a commit that referenced this pull request Jun 1, 2026
Wave 60 (R-CG-7): TokenKind::KwIn, NodeKind::StmtForRange.
parse_range_bound helper avoids struct-literal ambiguity.
Verilog/C/Rust/Zig codegen. Loop unroller extended.
9 new tests, all pass. 825 total.

Co-authored-by: Claude <claude@anthropic.com>
gHashTag added a commit that referenced this pull request Jun 1, 2026
Wave 60 (R-CG-7): TokenKind::KwIn, NodeKind::StmtForRange.
parse_range_bound helper avoids struct-literal ambiguity.
Verilog/C/Rust/Zig codegen. Loop unroller extended.
9 new tests, all pass. 825 total.

Co-authored-by: Claude <claude@anthropic.com>
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.

for-range loop: for i in start..end { body } (R-CG-7)

2 participants