-
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
Let annotations take an argumentList rather than expressionList | keyValueList
#633
Comments
If annotations take argumentList instead of either expressionList or keyValueList, the exact same behavior is acheived, but without introducing ambiguity.
I guess the one difference is "_".
But generally, yes, this seems like a nice simplification.
…On Thu, May 31, 2018 at 4:40 PM, Santiago Bautista ***@***.*** > wrote:
Currently in the P4-16 grammar, annotations can take either an expression
list or a keyValuePair List for their arguments and this allows arguments
to annotations to be named:
annotation
: '@' name
| '@' name '(' expressionList ')'
| '@' name '(' keyValueList ')'
;
But this makes the grammar ambiguous, because there is no way of telling
whether the empty list is an expressionList or a keyValueList.
There is a non-ambiguous and nicer way of achieving exactly the same
behavior:
there is a non-terminal in P4-16 grammar called argumentList , and each
argument can either be an expression or a name '=' expression (i.e. a
keyValuePair).
So if annotations took an argumentList, instead of either an
expressionList or a keyValueList, we would have exactly the same behavior,
but without introducing ambiguity to the grammar.
I will open a Pull Request about this.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#633>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABwi0j3bQZIHZHwYKEi5qNqNArmxKABgks5t4FU2gaJpZM4UVs10>
.
|
To be precise, there is another difference: if annotations take argumentList, then one single annotation can take both key-value pairs and expressions; whereas with the current grammar one annotation can either only take expressions or only take key-value pairs. But this extra flexibility can, I guess, be useful, and AFAIK it doesn't introduce any problems. |
For information: |
@SantiagoBautista I like this, good catch! |
Thank you @chrispsommers ! |
This is no longer relevant, since we now have free-form annotations. |
Currently in the P4-16 grammar, annotations can take either an expression list or a keyValuePair List for their arguments and this allows arguments to annotations to be named:
But this makes the grammar ambiguous, because there is no way of telling whether the empty list is an expressionList or a keyValueList.
There is a non-ambiguous and nicer way of achieving exactly the same behavior:
there is a non-terminal in P4-16 grammar called argumentList , and each argument can either be an expression or a
name '=' expression
(i.e. a keyValuePair).So if annotations took an argumentList, instead of either an expressionList or a keyValueList, we would have exactly the same behavior, but without introducing ambiguity to the grammar.
I will open a Pull Request implementing this solution.
The text was updated successfully, but these errors were encountered: