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

Fix #222 and #255 #311

Merged
merged 2 commits into from
Dec 10, 2018
Merged

Fix #222 and #255 #311

merged 2 commits into from
Dec 10, 2018

Conversation

dbrotz
Copy link
Contributor

@dbrotz dbrotz commented Dec 2, 2018

This fixes the ambiguity between the const T_OP_SUB const and T_ID T_OP_SUB T_ID rules by deferring the check to distinguish the two cases until after Bison parses it.

I have tested it on several RGBDS projects and it works fine. However, if anyone is relying on the order of operations quirks caused by the ambiguity bug, they will need to update their code.

You will need to use parentheses when subtracting labels in cases like this:
x = 1 + label2 - label1 (won't work)
x = 1 + (label2 - label1) (will work)

If you don't use parentheses, the usual order of operations results in the equivalent of this:
x = (1 + label2) - label1

The assembler will issue an error in that case.

Fixes #222.
Fixes #255.

@dbrotz dbrotz changed the base branch from master to develop December 2, 2018 23:42
@AntonioND
Copy link
Member

Oh wow. This is why I didn't bother fixing that issue... I'll take a look at this.

By the way, only now I've noticed that the Travis CI build was broken, I've fixed it as well.

@AntonioND
Copy link
Member

By the way, feel free to add yourself to CONTRIBUTORS.rst.

@AntonioND AntonioND merged commit 2795404 into gbdev:develop Dec 10, 2018
AntonioND added a commit that referenced this pull request Dec 10, 2018
@AntonioND
Copy link
Member

And I think that all the changes done lately deserve a new version, I'll do it at some point this week.

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