Skip to content

binop except assign and conditionals#141

Merged
0xGeorgii merged 3 commits intomainfrom
140-binop-except-assign-cond
Feb 24, 2026
Merged

binop except assign and conditionals#141
0xGeorgii merged 3 commits intomainfrom
140-binop-except-assign-cond

Conversation

@0xGeorgii
Copy link
Contributor

@0xGeorgii 0xGeorgii commented Feb 23, 2026

Closes #140

@0xGeorgii 0xGeorgii changed the title 140 binop except assign cond binop except assign and conditionals Feb 23, 2026
@0xGeorgii 0xGeorgii self-assigned this Feb 23, 2026
@0xGeorgii 0xGeorgii added inf2wasm Inference to WASM converting codegen Bytecode emitting labels Feb 23, 2026
@codecov
Copy link

codecov bot commented Feb 23, 2026

Codecov Report

❌ Patch coverage is 88.57143% with 20 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
core/ast/src/arena.rs 46.15% 7 Missing ⚠️
core/type-checker/src/type_info.rs 0.00% 7 Missing ⚠️
core/wasm-codegen/src/compiler.rs 96.12% 6 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request implements comprehensive binary and unary expression lowering for the WASM code generator, enabling the Inference compiler to translate arithmetic, comparison, logical, bitwise, and shift operations to WebAssembly bytecode. The implementation correctly handles sign-sensitive instruction selection for both 32-bit and 64-bit integer types.

Changes:

  • Added binary expression lowering with correct dispatch based on operand types (signed/unsigned, i32/i64) for all operators except ** (power) and assignments
  • Added unary expression lowering for negation (-), logical NOT (!), and bitwise NOT (~) using WASM idioms
  • Added parenthesized expression support (transparent wrapper)
  • Extended variable definition initializers to accept any value-producing expression
  • Added 11 comprehensive test suites with 2,300+ lines of test code covering edge cases, type combinations, and compound expressions

Reviewed changes

Copilot reviewed 36 out of 47 changed files in this pull request and generated no comments.

Show a summary per file
File Description
core/wasm-codegen/src/compiler.rs Core implementation: binary/unary expression lowering, type helpers, instruction dispatch logic
core/wasm-to-v/src/wasm_parser.rs Updated example to use codegen_output.wasm() accessor
core/wasm-to-v/src/lib.rs Updated custom instruction encoding table
core/wasm-to-v/README.md Updated custom instruction encoding table
core/type-checker/src/typed_context.rs Added documentation for TypedContext and MissingExpressionType
core/type-checker/src/type_info.rs Added documentation for TypeInfoKind, TypeInfo, and helper methods
core/type-checker/src/lib.rs Added documentation for TypeCheckerBuilder::new
core/cli/src/main.rs Updated non-deterministic instructions list in doc comment
core/cli/README.md Updated codegen completion message
core/ast/src/arena.rs Added documentation for arena query methods
core/ast/docs/nodes.md Added codegen notes for BinaryExpression and PrefixUnaryExpression
CHANGELOG.md Comprehensive entry documenting all new binary/unary operator support
tests/src/codegen/wasm/mod.rs Registered 9 new test modules
tests/src/codegen/wasm/base.rs Added binary_ops_test with comprehensive execution tests
tests/src/codegen/wasm/validation.rs Added 14 validation tests for binary/unary/parenthesized expressions
tests/src/codegen/wasm/binops_*.rs (9 files) Test implementations for unary combos, u32, sub-i32, shift edge, paren, i64 cmp/bitwise/arith, compound, and bool operations
tests/test_data/codegen/wasm/**/*.inf (11 files) Source test fixtures covering all operator combinations and edge cases
tests/test_data/codegen/wasm/**/*.wasm (11 files) Golden WASM bytecode files for equivalence testing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@0xGeorgii 0xGeorgii marked this pull request as ready for review February 24, 2026 01:44
@0xGeorgii 0xGeorgii merged commit f4bdce0 into main Feb 24, 2026
6 checks passed
@0xGeorgii 0xGeorgii deleted the 140-binop-except-assign-cond branch February 24, 2026 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codegen Bytecode emitting inf2wasm Inference to WASM converting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Binary expression operations (except assignment and conditionals)

2 participants