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

Adding support for bitwise negation and XOR operators and for bitwise AND, XOR, and OR compound assignments #77

Merged
merged 3 commits into from
Aug 28, 2024

Conversation

FilippoCarloni
Copy link
Contributor

Bitwise operators are essential for many low-level, high-performance operations, such as checksum or hashing. Thus, covering the complete set of bitwise operators can improve Build-it's capability. At the same time, compound assignments can increase the code readability when using these operators.

This patch adds the unary bitwise negation operator (i.e., ~) and the binary bitwise XOR operator support (i.e., ^). Moreover, it adds support for compound assignments for the bitwise AND, XOR, and OR operators (i.e., &=, ^=, |=, respectively).

@@ -54,6 +59,12 @@ void bitwise_or_expr::dump(std::ostream &oss, int indent) {
expr1->dump(oss, indent + 1);
expr2->dump(oss, indent + 1);
}
void bitwise_xor_expr::dump(std::ostream &oss, int indent) {
printer::indent(oss, indent);
oss << "BITWISE_xOR_EXPR" << std::endl;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor NIT, but let's fix capitalization here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for spotting the typo! I fixed it.

Copy link
Collaborator

@AjayBrahmakshatriya AjayBrahmakshatriya 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 to me! Thanks for adding this feature 🎉

@AjayBrahmakshatriya AjayBrahmakshatriya merged commit 9c4f2ee into BuildIt-lang:master Aug 28, 2024
2 checks passed
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.

2 participants