Skip to content

WIP: Add division and modulus operators#263

Draft
AaronWebster wants to merge 1 commit into
masterfrom
division-and-modulus-operators
Draft

WIP: Add division and modulus operators#263
AaronWebster wants to merge 1 commit into
masterfrom
division-and-modulus-operators

Conversation

@AaronWebster
Copy link
Copy Markdown
Collaborator

Summary

Work in progress: adds / (division) and % (modulus) operators to the Emboss expression language.

Changes span:

  • Front end: tokenizer/grammar/module IR, expression bounds, type checking, and constraint validation for the new operators.
  • Back end: C++ codegen support, runtime arithmetic helpers, and golden output.
  • Tests: unit tests in constraints_test.py, expression_bounds_test.py, module_ir_test.py, plus an integration test (division_modulus.emb + division_modulus_test.cc) and an arithmetic runtime test.
  • Docs: grammar and language reference updates.
  • Formatter: format_emb.py handles the new operators.

Status

Draft — still iterating. Notable open items / things to double-check:

  • Cached parser regeneration is included (large diff in cached_parser.py).
  • Bounds and constraint behavior around division-by-zero / negative operands needs another pass.

Test plan

  • bazel test //... clean
  • Verify generated C++ for division_modulus.emb matches the golden
  • Confirm formatter output for new operators
  • Review division-by-zero handling in constraints and bounds

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