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

Michael Studman mstudman at gmx.net
Mon Aug 30 02:39:38 PDT 2004


Hi all.

I've updated my Java 1.5 grammar hosted on ANTLR to address the issues
Michael Stahl outlined in a previous email. In addition I fixed a few
other bugs, did some refactoring of types to maximise reuse and
integrated his excellent switchable enum/assert keyword checking.

Here are some problems I found with his grammar:

* It does not allow annotations of form: @MyAnnotation() (it expects at
least one parameter)

* It does not allow annotation array member initialisations with other
annotations @MyAnno(something = { @MyOtherAnno() })

* It does not support annotation fields with C-style array syntax:
@interface MyAnno
{
	int name4()[]; //vs int[] name4();
}

* There seems to be some weird incompatibility between the recogniser
and the tree parser w.r.t. enum constant invocations (enum constant
initialisers)
e.g.
public enum MyEnum
{
	CONSTANT1(123);
}
seems to pass in the recognizer but fails in the tree parser.

* It is possibly too lenient with enum definitions: it allows enum
constants to have static initialisers and constructors.

* It's possibly too lenient with variable-length arguments: it allows
them at any position in a variable list (mine only allows it at the end
of a variable list) and it also allows it in variables defined within
"for" and "catch" productions.

* It accepts parameters that are declared final more than once.

These last three points probably aren't major ones and would be checked
elsewhere in a compiler etc but I thought I'd mention them as my test
suite highlighted these as differences between the two grammars.

Regards,
Michael Studman.


> -----Original Message-----
> From: news [mailto:news at sea.gmane.org] On Behalf Of Michael Stahl
> Sent: 25 August 2004 19:02
> To: antlr-interest at yahoogroups.com
> Subject: [antlr-interest] Re: Re: yet another java 1.5 grammar
> 
> On Tue, 24 Aug 2004 18:34:51 -0700, Terence Parr wrote:
> > On Aug 24, 2004, at 4:46 PM, lgcraymer wrote:
> >
> >> Michael--
> >>
> >> Please send Ter a copy so that he can put it in the "sharing"
section
> >> of antlr.org.
> >
> > You can add it yourself with the add grammar button. :)   Please
> > include the "readme" from your email in the zip. :)  Also please put
> > something describing the difference to the other 1.5 grammar in the
> > submitted description.  Perhaps we should get a single merged
grammar.
> 
> ok, will do that :) i couldn't imagine you let just anybody
> upload stuff there, so i didn't try :)
> 
> i don't think merging the two grammars makes much sense though;
> i suggest you either pick one or a version of the other with
> the bugs i identified in my previous posting fixed.
> that seems like it is much less work with nearly the same
> benefit.
> 
> do you have any comment on the syntactic predicate in loops
> issue i have with antlr? (see original posting)
> 
> michael
> 
> 
> 
> 
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> ---
> Incoming 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
> 

---
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