@remexre pointed out that if you have e.g. annotation foo::Integer; in grammar a and annotation foo::String in grammar b, you can have
nonterminal Thing with a:foo, b:foo;
production thing top::Thing ::= {}
However, annotations get reduced to their short names in the function type, meaning you end up with multiple named parameters foo. This actually still sort of works - you can apply it as thing(foo=42, foo="hello"). However this is confusing, one would need to always qualify the annotation name when accessing it as t.a:foo or t.b:foo, and also the type expression syntax for named params seems to be broken with more than one named parameter.
Annotations can only occur on a nonterminal in the grammar of the nonterminal anyway - thus I vote we ban having multiple annotations with the same short name occuring on a nonterminal.
@remexre pointed out that if you have e.g.
annotation foo::Integer;
in grammara
andannotation foo::String
in grammarb
, you can haveHowever, annotations get reduced to their short names in the function type, meaning you end up with multiple named parameters
foo
. This actually still sort of works - you can apply it asthing(foo=42, foo="hello")
. However this is confusing, one would need to always qualify the annotation name when accessing it ast.a:foo
ort.b:foo
, and also the type expression syntax for named params seems to be broken with more than one named parameter.Annotations can only occur on a nonterminal in the grammar of the nonterminal anyway - thus I vote we ban having multiple annotations with the same short name occuring on a nonterminal.