Skip to content

add missing operators and fix precedences#34

Merged
SpaceManiac merged 2 commits into
masterfrom
enzo/add-more-operators-to-parser
Jun 17, 2025
Merged

add missing operators and fix precedences#34
SpaceManiac merged 2 commits into
masterfrom
enzo/add-more-operators-to-parser

Conversation

@ecioppettini

Copy link
Copy Markdown
Contributor

closes #32

I also fixed the operator precedences since the existing ones were just placeholders.

@ecioppettini
ecioppettini requested a review from SpaceManiac June 16, 2025 19:08
@ecioppettini ecioppettini self-assigned this Jun 16, 2025
GreaterEq(Box<Self>, Box<Self>),
// Arithmetic operators
/// `-a`
Neg(Box<Self>),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Any particular reason to drop Neg? Wasm has a floating-point neg instruction, and integer neg is easy to implement as ~x + 1

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Mostly because it was previously ~, and when I changed that I removed it. But it probably makes sense to keep it I guess.

So I added it back. I'm not really sure how much people actually use the unary negation in general though.

@SpaceManiac
SpaceManiac merged commit a5137d7 into master Jun 17, 2025
6 checks passed
@SpaceManiac
SpaceManiac deleted the enzo/add-more-operators-to-parser branch June 17, 2025 19:14
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.

Add operators to AST and parser

2 participants