Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define arithmetic and bitwise operations #314

Merged
merged 10 commits into from
Mar 25, 2022

Conversation

brendanzab
Copy link
Member

@brendanzab brendanzab commented Mar 24, 2022

This introduces a bunch of primitive operations for signed and unsigned integers. I need to figure out a better way of managing these primitives (I have some ideas about this), but I'm working with what I have right now!

Todo:

  • primitive variants
  • add to elaboration environment
  • evaluation steps for primitives

Future work:

  • Consider what to do about underflow, overflow, and division by zero errors (see: Refinement types #258)
  • Add infix operators for addition, subtraction, multiplication, and division

Closes #257

@mikeday
Copy link
Contributor

mikeday commented Mar 24, 2022

Do we need bitwise ops for signed integer types or it would it be better to omit those and add casts to unsigned types later?

@brendanzab
Copy link
Member Author

Ahh yes, that'd make more sense. Thanks!

@brendanzab brendanzab force-pushed the primitive-operations branch 2 times, most recently from dcf3b85 to d1115b4 Compare March 24, 2022 06:28
@brendanzab brendanzab marked this pull request as ready for review March 24, 2022 07:06
These will get “stuck” if they overflow, which is a little frustraing, but better than causing runtime errors!
@brendanzab
Copy link
Member Author

Ok, this should be good to go!

Copy link
Contributor

@mikeday mikeday left a comment

Choose a reason for hiding this comment

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

Looks good!

Copy link
Contributor

@wezm wezm left a comment

Choose a reason for hiding this comment

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

Wow, you got these done super quick, nice 👍 Looks good to my untrained eyes.

@brendanzab brendanzab merged commit 86a6cd4 into yeslogic:main Mar 25, 2022
@brendanzab brendanzab deleted the primitive-operations branch March 25, 2022 05:01
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.

Builtin operators
3 participants