Skip to content

fix(codegen): improve Verilog + C backend quality for all specs - #52

Merged
gHashTag merged 1 commit into
masterfrom
fix/backend-quality
Apr 4, 2026
Merged

gHashTag merged 1 commit into
masterfrom
fix/backend-quality

Conversation

@gHashTag

@gHashTag gHashTag commented Apr 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • Implements ExprSwitch as nested ternary operators in Verilog backend (eliminates 12 unsupported expression placeholders)
  • Implements StmtFor as Verilog for-loops with integer iteration (eliminates 15 unsupported statement placeholders)
  • Fixes ExprReturn to assign to function name (Verilog semantics) instead of /* return */ placeholder (fixes 577 instances)
  • Sanitizes module names: hyphens/special chars → underscores (fixes 5 invalid Verilog module identifiers)
  • Adds current_fn_name tracking to VerilogCodegen struct

Results

Backend Failures Before Failures After Target
gen-verilog 0 (exit code) / 27 unsupported exprs 0 / 0 < 5
gen-c 0 0 < 5
gen (Zig) 0 0 No regression

Test plan

  • All 28 spec files pass gen-verilog (exit code 0)
  • All 28 spec files pass gen-c (exit code 0)
  • All 28 spec files pass gen (Zig — no regression)
  • Zero /* unsupported expr */ markers in Verilog output
  • Zero /* return */ placeholders in Verilog output
  • Zero hyphenated module names in Verilog output
  • cargo build --release succeeds
  • cargo test passes

Closes #49

🤖 Generated with Claude Code

- Implement ExprSwitch as nested ternary operators in Verilog backend
  (eliminates 12 unsupported expression placeholders)
- Implement StmtFor as Verilog for-loops with integer iteration
  (eliminates 15 unsupported statement placeholders)
- Fix ExprReturn to assign to function name (Verilog semantics)
  instead of emitting /* return */ placeholder (fixes 577 instances)
- Sanitize module names: hyphens and special chars → underscores
  (fixes 5 invalid Verilog module identifiers)
- Add current_fn_name tracking to VerilogCodegen struct

Results: 0/28 gen-verilog failures, 0/28 gen-c failures (target: < 5)
Zig backend (gen) unchanged — 0 regressions.

Closes #49

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gHashTag
gHashTag merged commit d733c97 into master Apr 4, 2026
3 checks passed
gHashTag added a commit that referenced this pull request Jun 1, 2026
fix(codegen): improve Verilog + C backend quality for all specs
@gHashTag
gHashTag deleted the fix/backend-quality branch June 16, 2026 13:45
gHashTag added a commit that referenced this pull request Jun 17, 2026
- Coq [MANUAL_FIX] audit: 65 tags across 12 files

- 1 invalid formula withdrawn (arcsin(8/(φπ)), argument > 1)

- 2 valid formulas identified (Lucas identities)

- 56 placeholders reclassified with granular tags

- +4 competitors: PMMD (#50), Priya et al. (#51), Gimranov (#52), Eusani (#53)

- Total competitors: 53

Closes #1190
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.

[TASK-003] Fix gen-verilog + gen-c for all specs (28 failures each)

1 participant