You may browse the JLS3 grammar at http://www.lykkenborg.no/java/grammar/JLS3.html.
The JLS3 (2005) itself is probably worth a re-read if you're programming with Java 1.5.0 (White 2005). Actually, I would say that it's a must if you don't want to end up as "Tiger" food! A substantial part of the Java grammar has been affected by the proposed changes to the JLS.
The proposed changes include:
- Generic Types (generics) (JSR 14)
- Metadata (JSR 175)
- Language Additions (JSR 201)
- Assertion (assert statement) (JSR 41)
- Memory Model and Thread Specification Revision (JSR 133)
- Unicode Supplementary Character Support (JSR 204)
(JLS3P 2005; J2SE5 2004)
Browsing through the grammar (JLS3P 2005), I found the following problems:
Grammar Changes for JLS3 (2005)
The following changes were made for the pre-publication PDF release.
- Many duplicates of rules are removed, for instance ArgumentList, EnumConstant, InterfaceType, Literal, OctalDigit, TypeName. Only the first instance of a rule is kept.
- TypeName was changed to TypeDeclSpecifier in rule InterfaceType
- 2 rules for TypeName was made into one
- The rule TypeDeclSpecifier was created
- The rule ClassType was fixed. TypeName replaced by TypeDeclSpecifier
- The rule TypeParameters was replaced by TypeParameter. The rule TypeParameter is now called from the rule TypeParameters
- The rules TypeParameters and TypeParameterList was found in 8.1.2 Generic Classes and Type Parameters
SimpleTypeName replaced Identifier in the rule ConstructorDeclarator.The nonterminal SimpleTypeName in rule ConstructorDeclarator is still not defined (JLS3 2005), (I renamed SimpleTypeName to Identifier, similar to the rule NormalClassDeclaration.)
- EnumConstant was replaced by EnumConstantName in rule SwitchLabel
- Added the rule EnumConstantName
- All NonWildTypeArguments replaced with TypeArguments in rule ClassInstanceCreationExpression
- TypeName replaced by ClassOrInterfaceType in rule ArrayCreationExpression
- SimpleTypeName in ConstructorDeclarator is not defined (JLS3P 2005:245). SimpleTypeName is not defined in JLS2 either. (I renamed SimpleTypeName to Identifier, similar to the rule NormalClassDeclaration.)
- Expression1 and Expression2 in AssertStatement is not defined (JLS3P 2005:369). (I renamed Expression1 and Expression2 to Expression).
TypeParameter (JLS3P 2005:65) is never called by any rules and the rule TypeParameters is missing. (I renamed the rule TypeParameter: to TypeParameters:)The rule TypeParameter is now called from the rule TypeParameterList.
- NonWildTypeArguments should probably be optional for MethodInvocation: TypeName . NonWildTypeArguments Identifier (ArgumentList opt) (JLS3P 2005:435), especially since NonWildTypeArguments is optional everywhere else. (I made NonWildTypeArguments optional.)
- There is no change in the rule VariableDeclaratorId: since JLS2 as indicated (JLS3P 2005:201).
- The rule Keyword: is not sorted for the keyword goto (JLS3P 2005:37). (I sorted it.)
- The formatting in 9.6 Annotation Types is not correct because everything is printed in italic (JLS3P 2005:271).
- Input and CompilationUnit are goal symbols. It's OK that no rules are calling them.
- MethodDeclarator is divided into two rules with the same name. This is confusing, but not an error. The division is an attempt to visualize that one of the rules (MethodDeclarator: MethodDeclarator [ ]) is deprecated, but still compatible. (I rewrote the two rules into one).
- Many rules are identical. This is confusing, but no error. (For instance the rule TypeName is identical to the rule PackageOrTypeName.)
- MarkerAnnotation in Annotation is defined, but well hidden on page 285.
- SingleElementAnnotation in Annotation is defined, but well hidden on page 285.
- CastExpression (JLS3P 2005:476) is clearly missing Dims opt (15.16 Cast Expressions) (I added Dims opt to the rule.)
- J2SE5. (2004). New Features and Enhancements, J2SE 5.0. California: Sun Microsystems, Inc. Retrieved Friday, April 01, 2005 from http://java.sun.com/j2se/1.5.0/docs/relnotes/features.html.
- JLS3. (2005). The Java Language Specification, 3rd Edition (pre-publication PDF release). California: Sun Microsystems, Inc. Retrieved Tuesday, April 19, 2005 from http://java.sun.com/docs/books/jls/download/langspec-3.0.pdf.
- JLS3P. (2005). The Java Language Specification, 3rd Edition (Proposed Changes to the JLS). California: Sun Microsystems, Inc. Retrieved Monday, March 28, 2005 from http://java.sun.com/docs/books/jls/jls-proposed-changes.html.
- JLS3 2005
- White, Tom. (2005). The Java Language Specification, 3rd Edition. Tom White's Blog. Retrieved Tuesday, March 29, 2005 from http://weblogs.java.net/blog/tomwhite/archive/2005/02/the_java_langua_1.html.