-
Notifications
You must be signed in to change notification settings - Fork 82
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
Application of suggestion #633 #634
Conversation
If annotations take argumentList instead of either expressionList or keyValueList, the exact same behavior is acheived, but without introducing ambiguity.
If annotations take expressionList instead of keyValueList or expressionList, then the non-terminals keyValueList and keyValuePair are not used anymore in the grammar, so they can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The compiler implements this and bison did not complain about an ambiguity.
The grammar in the compiler does not allow an empty keyValueList, so there's no ambiguity. Why the grammar in the spec was different, I don't know. |
Annotations never had a clear semantics in the spec, but they have an internal compiler api to access them, which will need to change if we take this pr. |
Although this does simplify the grammar, it changes the set of programs accepted (as you point out) and possibly it may require a different representation for the Annotation IR class in the compiler. I believe that this fix makes things more complicated. The right fix is to not accept an empty key-value list. |
The compiler and the spec already differ in many ways:
If this pr simplifies the grammar, is it really a problem if it temporarily adds another difference between the compiler and the grammar? |
The abstract method is an experimental feature and has not been accepted to the spec yet. |
This also changes the (not explicitly specified) contract between the front-end and the back-end: today we assume that a back-end can check for annotations in one of the two formats, but with your change back-ends have to be ready to accept annotations that have a mix of formats.
|
I agree with @mbudiu-vmw that not accepting the empty keyValueList is a solution to ambiguity that does not require changing the compiler in any way (because it actually correspond to putting the compiler's current behavior into the grammar). Since the proposition in this PR seems to need further discussion, I will do a PR implementing @mbudiu-vmw proposition, that shouldn't raise any problem, and we will see for this PR later. What do you think? PS : I hadn't seen your latest comment when I wrote this one |
The problem is that we will release a new specification this week, so whatever choice we make will become official. If this needs further discussion we won't be able to release this part of the spec. |
Ok. So I suggest that for the spec release we take your proposition: requiring in the grammar that the keyValueList s are non-empty. |
I will also make sure to open a pull request that updates the grammar concerning value_set in parsers, because there are currently some rules missing in the grammar (and present in the implementation, so it is a bug in the grammar). |
I appreciate. |
Closing this for now... |
This Pull request offers a solution for issue #633 .
If annotations take argumentList instead
of either expressionList or keyValueList,
the exact same behavior is acheivable,
but without introducing ambiguity into the grammar.