[antlr-interest] RE: Re: Re: yet another java 1.5 grammar

Michael Studman mstudman at gmx.net
Tue Aug 31 09:37:44 PDT 2004


Hi Michael.

> cool! but it seems like you missed one...
> in rule postfixExpression:
> DOT "super"    should be    DOT typeArguments? "super"
> (which will make some refactoring necessary there)

I must have overlooked this, I'll check it out.

> > * It does not support annotation fields with C-style array syntax:
> > @interface MyAnno
> > {
> > 	int name4()[]; //vs int[] name4();
> > }
> 
> afaik this is correct, i.e. the above example is invalid.
> see the draft of jls 3rd ed. that is in jsr14 public final draft
> chapter 9 page 13 (page 271):
> in production AnnotationTypeElementDeclaration, the only thing
> that can follow the pair of parens is DefaultValue_opt.

If you're following the letter of the spec, then yes, you are correct
since the production for annotation fields makes no reference to this
antiquated syntactic variant. Similarly, the production for interface
methods (JLS 3rd ed. 9.4) makes no reference to it either. The
production for class fields, of course, allows this (8.4.1).

The reality is that every javac compiler I've used has allowed interface
methods to use this syntax in addition to the valid use on class
methods. Similarly, the javac that shipped with JDK 1.5 beta 2 allows
this syntax on annotation fields hence why I included it in my grammar.

I'm going to keep it in my grammar for the time being. I think it's
better to be slightly more lenient yet in-sync with the most popular
compiler than to follow the spec to its letter but reject source that is
accepted by the said compiler (unless, of course, you want to build a
precisely compliant compiler). If the next beta/full release of the
JDK/javac cans this unspecified syntax acceptance then there's no real
reason to keep it in my grammar.

If you don't want to include it in yours then the consistent approach
would probably be to remove this from interface methods too.

> 
> PS: now how do i upload my fixed grammar? there is no "update grammar"
> button that i can see... shold i just add it again and hope someone
> removes the old one? or should i mail it to someone who can update?
> : now how do i upload my fixed grammar? there is no "update grammar"
> 

Send to Terrence and he'll update it for you.

Michael.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.745 / Virus Database: 497 - Release Date: 27/08/2004
 



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list