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 non-associativity of non-eq comparison ops in LL1 grammar #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zx1239856
Copy link

Non-equal comparison operators such as <, >, ge, le come without associativity, yet current LL(1) grammar treats them as left associative, which can bring about erroneous parsing output when handling a < b < c (this form should have triggered a syntax error)

@Hoblovski Hoblovski added the bug Something isn't working label Jul 20, 2020
@Hoblovski
Copy link
Member

Hoblovski commented Jul 20, 2020

This patch only fixes PA1B.

Although PA1A specifies that '<=' is nonassoc, we can still write a<b<c and the parser is happy.

Maybe we just accept that, and let the subsequent semantic analysis do the job?

@Hoblovski Hoblovski added question Further information is requested and removed bug Something isn't working labels Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants