Skip to content

Bitwise xor binary operator added using ^#2

Open
Axanimander wants to merge 3 commits into
Asterisk007:devfrom
Axanimander:bitwise-xor
Open

Bitwise xor binary operator added using ^#2
Axanimander wants to merge 3 commits into
Asterisk007:devfrom
Axanimander:bitwise-xor

Conversation

@Axanimander

@Axanimander Axanimander commented Jun 19, 2025

Copy link
Copy Markdown

Added bitwise XOR function using ^ with an example program which successfully compiles and runs (bitwise.prse).

Files Modified:

  • prse.y
  • prse.l
  • expressions/Expressions.h

Files added:

  • Bitwise.h
  • Bitwise.cpp

Why?

I noticed the ^ token was in the parser and unused. I also wanted to possibly add things like bit shifts in the future.

Does it work?

Yes, I wrote a program that used the new binary operator and verified correct output.

Prove it?

image

image

@Asterisk007

Copy link
Copy Markdown
Owner

@Axanimander good work, thanks for the contribution. I have a few requests before I accept the PR:

  • Remove the spare println("hello world") in examples/bitwise.prse. It seems unnecessary and unrelated to the example in question.
  • Show that the syntax error handling you included matches with the other existing syntax error handlers in the other operators. Testing extends to validating incorrect usage, not just correct usage.
  • Also, I would appreciate it if you also followed the general formatting style established in the other example PRSE files, just for the sake of cohesion. If you leave it alone I'm just going to change it myself for the official release :P

I look forward to any future PRs from you!

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