Index
Java Grammar Accepted by EPP
This document describes the Java grammar EPP accepts. The notation
is in extended BNF notation.
Plug-ins may add new alternatives to the non-terminals described in
this document and extend the grammar.
For implementation purposes, there are two types of non-terminals
and their extension methods are different.
- Non-terminals without the hash symbol (#) are those that were
defined using the defineNonTerminal macro.
By extending the methods xxxTop, xxxLeft, and xxxRight, you can add
alternatives such as ??IDEAC>prefix operators???IDEAC>, left
recursive rules, and right associative operators.
You must NOT extend the method xxx itself.
- Non-terminals with the hash symbol (#) are those that are
defined as normal methods without using the defineNonTerminal macro.
You cannot use xxxTop, xxxLeft, and xxxRight with this type of non-terminal.
Extend method xxx in order to add alternatives.
( "xxx" is a string derived from the non-terminal name with the first
character being in lower case. )
About meta-symbols:
Empty (<e>)
Zero or more iterations of the preceding symbol (<*>)
Zero or more iterations of the preceding two symbols (<**>)
One or more iterations of the preceding two symbols (<..>)
??IDEAC>Iteration in the form of "A B <**> A" of the preceding two
symbols (designated as "A B") (<...>)???IDEAC>
# CompUnit.java
StartTop#:
CompilationUnit
CompilationUnit#:
PackageDeclaration ImportDeclarations TypeDeclarations
PackageDeclaration:
PackageDeclarationBody
PackageDeclarationBody#:
<e>
package name ;
ImportDeclarations:
ImportDeclarationsBody
ImportDeclarationsBody#:
ImportDeclaration <*>
ImportDeclaration:
ImportDeclarationBody
ImportDeclarationBody#:
import name .* ;
import name ;
TypeDeclarations:
TypeDeclarationsBody
TypeDeclarationsBody#:
TypeDeclaraion <*>
TypeDeclaration:
;
TypeDeclarationOtherwise
# TypeDecl.java
Extends:
ExtendsOtherwise
ExtendsOtherwise#:
<e>
extends Name , <...>
Implements:
ImplementsOtherwise
ImplementsOtherwise#:
implements Name , <...>
Throws:
ThrowsOtherwise
ThrowsOtherwise#:
throws Name , <...>
FormalParameter:
FormarlParameterOtherwise
FormalParameterList#:
FormalParameter , <...>
FormalParameterOtherwise#:
Modifiers Type VariableDeclaratorId
TypeDeclarationOtherwise#:
Modifiers ClassDeclaration
ClassDeclaration#:
Identifier Identifier Extends Implements Throws ClassBody
ClassBody#:
{ ClassBodyRest
ClassBodyRest#:
ClassBodyDeclaration <*> }
ClassBodyDeclaration:
StaticInitializer
Block
;
Modifier ClassBodyDeclarationAfterModifiers
StaticInitializer#:
static Block
ClassBodyDeclarationAfterModifiers#:
ClassDeclaration
ConstructorDeclaration
MethodOrFieldDeclaration
ConstructorDeclaration#:
Identifier ( FormalParameterList ) Throws Block
MethodOrFieldDeclaration#:
Type MethodDeclaration
Type FieldDeclaration
MethodDeclaration#:
Identifier ( FormalParameterList ) [ ] <**> Throws Statement
Identifier ( FormalParameterList ) [ ] <**> Throws Block
FieldDeclaration#:
VariableDeclarators ;
# Statement.java
Statement:
Block
;
switch ( Expression ) Block
case Expression :
default :
do Statement while ( Expression ) ;
break ;
break Identifier ;
continue ;
continue Identifier ;
return ;
return Expression ;
synchronized ( Expression ) Block
throw Expression ;
try Block CatchClause <*> FinallyClause_opt
if ( Expression ) Statement else Statement
if ( Expression ) Statement
while ( Expression ) Statement
for ( Statement Expression_opt ; Expression_opt ) Statement
StatementOtherwise
StatementOtherwise#:
Expression ;
Expression : # Error if Expression is not an id
LocalVariableDecl
Block:
BlockOtherwise
BlockOtherwise#:
{ BlockRest
BlockRest#:
Statement <*> }
CatchClause#:
catch ( FormalParameter ) Block
FinallyClause#:
finally Block
Modifiers:
ModifiersOtherwise
Modifier:
<e>
public protected private static abstract final
native synchronized transient volatile
LocalVariableDecl#:
Modifiers ClassDeclaration
Modifiers Type VariableDeclarators ;
ModifiersOtherwise#:
Modifier <*>
VariableDeclarators#:
variableDeclarator , <...>
VariableDeclarator#:
VariableDeclaratorId
VariableDeclaratorId = VariableInitializer
VariableDeclaratorId:
Identifer
VariableDeclaratorId [ ]
VariableInitializer#:
ArrayInitializer
ExpressionNoComma
ArrayInitializer#:
{ , }
{ }
{ VariableIntializer , <...> , }
{ VariableIntializer , <...> }
# Exp.java, ExpNonTerm.java
Primary:
Literal
this ( ArgumentList )
this
super ( ArgumentList )
super . Identifier ( ArgumentList )
super . Identifier
( Expression ) unaryExpression # If Expression is basic type
( Expression ) unaryExpressionNotPlusMinus # If Expression is type
( Expression )
InstanceCreation
Primary . InstanceCreation
Primary . class
Primary . Identifier ( ArgumentList )
Primary . Identifier
Primary [ ]
Primary [ Expression ]
PrimaryOtherwise
Type#:
Primary
InstanceCreation#:
new Name ( ArgumentList ) ClassBody
new Name ( ArgumentList )
new Name ArrayCreation
ArrayCreation#:
[ ] ArrayInitializer_opt
[ Expression ] ArrayInitializer_opt
PostfixExpression:
PostfixExpression ++
PostfixExpression --
Primary
UnaryExpressionNotPlusMinus:
~ UnaryExpression
! UnaryExpression
PostfixExpression
UnaryExpression:
++ UnaryExpression
-- UnaryExpression
+ UnaryExpression
- UnaryExpression
UnaryExpressionNotPlusMinus
MemberSectionExpression:
MemberSectionExpression .* UnaryExpression
UnaryExpression
MultipicativeExpression:
MultiplicativeExpression * MemberSectionExpression
MultiplicativeExpression / MemberSectionExpression
MultiplicativeExpression % MemberSectionExpression
MemberSectionExpression
AdditiveExpression:
AdditiveExpression + MultiplicativeExpression
AdditiveExpression - MultiplicativeExpression
MultiplicativeExpresson
ShiftExpression:
ShiftExpression << AdditiveExpression
ShiftExpression >> AdditiveExpression
ShiftExpression >>> AdditiveExpression
AdditiveExpression
RelationalExpression:
RelationalExpression < ShiftExpression
RelationalExpression > ShiftExpression
RelationalExpression <= ShiftExpression
RelationalExpression >= ShiftExpression
RelationalExpression instanceof ShiftExpression
ShiftExpression
EqualityExpression:
EqualitExpression == RelationalExpression
EqualitExpression != RelationalExpression
RelationalExpression
AndExpression:
AndExpression & EqualitiExpression
EqualityExpression
ExclusiveOrExpression:
ExclusiveOrExpression ^ AndExpression
AndExpression
InclusiveOrExpression:
InclusiveOrExpression | ExclusiveOrExpression
ExclusiveOrExpression
ConditionalAndExpression:
ConditionalAndExpression && InclusiveOrExpression
InclusiveOrExpression
ConditionalOrExpression:
ConditinalOrExpression || ConditionalAndExpression
ConditionalAndExpression
ConditionalExpression:
ConditionalOrExpression ? Expression : ConditionalExpression
ConditionalOrExpression
AssignmentExpression:
ConditionalExpression = AssignmentExpression
ConditionalExpression *= AssignmentExpression
ConditionalExpression /= AssignmentExpression
ConditionalExpression %= AssignmentExpression
ConditionalExpression += AssignmentExpression
ConditionalExpression -= AssignmentExpression
ConditionalExpression <<= AssignmentExpression
ConditionalExpression >>= AssignmentExpression
ConditionalExpression >>>= AssignmentExpression
ConditionalExpression &= AssignmentExpression
ConditionalExpression ^= AssignmentExpression
ConditionalExpression |= AssignmentExpression
ConditionalExpression
ExpressionNoComma:
AssignmentExpression
CommaExpression:
CommaExpression , ExpressionNoComma
ExpressionNoComma
Expression:
CommaExpression
Name#:
Identifier . <...>
PrimaryOtherwise#:
Identifier . <..> InstanceCreation
Identifier . <..> class
Identifier ( ArgumentList )
Identifier
Identifier . <...> ( ArgumentList )
Identifier . <...>
Argument:
ExpressionNoComma
ArgumentList#:
Argument , <...>
Index