p4lang / p4-spec

Apache License 2.0
175 stars 80 forks source link

Possible inconsistency with annotation position #289

Closed antoninbas closed 7 years ago

antoninbas commented 7 years ago

Annotations on match key elements come after the key element, while in all other cases, it seems that the annotations come before the object they annotate (e.g. struct fields). Is there a reason for this?

mihaibudiu commented 7 years ago

Yes, it is due to the bison grammar. Putting them in front makes the grammar ambiguous, since the annotation has an optional list of expressions, which could be interpreted as the key expression.