BNF for HPJava1.1.jj

NON-TERMINALS

CompilationUnit ::= ( PackageDeclaration )? ( ImportDeclaration )* ( TypeDeclaration )* <EOF>
PackageDeclaration ::= "package" Name ";"
ImportDeclaration ::= "import" Name ( "." "*" )? ";"
TypeDeclaration ::= ClassDeclaration
| InterfaceDeclaration
| ";"
ClassDeclaration ::= ( "abstract" | "final" | "public" )* UnmodifiedClassDeclaration
UnmodifiedClassDeclaration ::= "class" <IDENTIFIER> ( "extends" Name )? ( "implements" NameList )? ClassBody
ClassBody ::= "{" ( ClassBodyDeclaration )* "}"
NestedClassDeclaration ::= ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* UnmodifiedClassDeclaration
ClassBodyDeclaration ::= Initializer
| NestedClassDeclaration
| NestedInterfaceDeclaration
| ConstructorDeclaration
| MethodDeclaration
| FieldDeclaration
| ";"
MethodDeclarationLookahead ::= ( "public" | "protected" | "private" | "static" | "abstract" | "final" | "native" | "synchronized" )* ResultType <IDENTIFIER> "("
InterfaceDeclaration ::= ( "abstract" | "public" )* UnmodifiedInterfaceDeclaration
NestedInterfaceDeclaration ::= ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* UnmodifiedInterfaceDeclaration
UnmodifiedInterfaceDeclaration ::= "interface" <IDENTIFIER> ( "extends" NameList )? "{" ( InterfaceMemberDeclaration )* "}"
InterfaceMemberDeclaration ::= NestedClassDeclaration
| NestedInterfaceDeclaration
| MethodDeclaration
| FieldDeclaration
| ";"
FieldDeclaration ::= ( "public" | "protected" | "private" | "static" | "final" | "transient" | "volatile" )* Type VariableDeclarator ( "," VariableDeclarator )* ";"
VariableDeclarator ::= VariableDeclaratorId ( "=" VariableInitializer )?
VariableDeclaratorId ::= <IDENTIFIER> ( ArraySignature )*
VariableInitializer ::= ArrayInitializer
| Expression
ArrayInitializer ::= "{" ( VariableInitializer ( "," VariableInitializer )* )? ( "," )? "}"
MethodDeclaration ::= ( "public" | "protected" | "private" | "static" | "abstract" | "final" | "native" | "synchronized" )* ResultType MethodDeclarator ( "throws" NameList )? ( Block | ";" )
MethodDeclarator ::= <IDENTIFIER> FormalParameters ( ArraySignature )*
FormalParameters ::= "(" ( FormalParameter ( "," FormalParameter )* )? ")"
FormalParameter ::= ( "final" )? Type VariableDeclaratorId
ConstructorDeclaration ::= ( "public" | "protected" | "private" )? <IDENTIFIER> FormalParameters ( "throws" NameList )? "{" ( ExplicitConstructorInvocation )? ( BlockStatement )* "}"
ExplicitConstructorInvocation ::= "this" Arguments ";"
| ( PrimaryExpression "." )? "super" Arguments ";"
Initializer ::= ( "static" )? Block
ArraySignature ::= "[" "]"
| "[" "[" DistArrayDimAttList "]" "]"
| "#"
DistArrayDimAttList ::= ( "*" )? ( "," ( "*" )? )*
Type ::= ( PrimitiveType | Name ) ( ArraySignature )*
PrimitiveType ::= "boolean"
| "char"
| "byte"
| "short"
| "int"
| "long"
| "float"
| "double"
ResultType ::= "void"
| Type
Name ::= <IDENTIFIER> ( "." <IDENTIFIER> )*
NameList ::= Name ( "," Name )*
Expression ::= ConditionalExpression ( AssignmentOperator Expression )?
AssignmentOperator ::= "="
| "*="
| "/="
| "%="
| "+="
| "-="
| "<<="
| ">>="
| ">>>="
| "&="
| "^="
| "|="
ConditionalExpression ::= ConditionalOrExpression ( "?" Expression ":" ConditionalExpression )?
ConditionalOrExpression ::= ConditionalAndExpression ( "||" ConditionalAndExpression )*
ConditionalAndExpression ::= InclusiveOrExpression ( "&&" InclusiveOrExpression )*
InclusiveOrExpression ::= ExclusiveOrExpression ( "|" ExclusiveOrExpression )*
ExclusiveOrExpression ::= AndExpression ( "^" AndExpression )*
AndExpression ::= EqualityExpression ( "&" EqualityExpression )*
EqualityExpression ::= InstanceOfExpression ( ( "==" | "!=" ) InstanceOfExpression )*
InstanceOfExpression ::= RelationalExpression ( "instanceof" Type )?
RelationalExpression ::= ShiftExpression ( ( "<" | ">" | "<=" | ">=" ) ShiftExpression )*
ShiftExpression ::= AdditiveExpression ( ( "<<" | ">>" | ">>>" ) AdditiveExpression )*
AdditiveExpression ::= MultiplicativeExpression ( ( "+" | "-" ) MultiplicativeExpression )*
MultiplicativeExpression ::= UnaryExpression ( ( "*" | "/" | "%" ) UnaryExpression )*
UnaryExpression ::= ( "+" | "-" ) UnaryExpression
| PreIncrementExpression
| PreDecrementExpression
| UnaryExpressionNotPlusMinus
PreIncrementExpression ::= "++" PrimaryExpression
PreDecrementExpression ::= "--" PrimaryExpression
UnaryExpressionNotPlusMinus ::= ( "~" | "!" ) UnaryExpression
| CastExpression
| PostfixExpression
CastLookahead ::= "(" PrimitiveType
| "(" Name ArraySignature
| "(" Name ")" ( "~" | "!" | "(" | <IDENTIFIER> | "this" | "super" | "new" | Literal )
PostfixExpression ::= PrimaryExpression ( "++" | "--" )?
CastExpression ::= "(" Type ")" UnaryExpression
| "(" Type ")" UnaryExpressionNotPlusMinus
PrimaryExpression ::= PrimaryPrefix ( PrimarySuffix )*
PrimaryPrefix ::= Literal
| ResultType "." "class"
| AllocationExpression
| "this"
| "super"
| "(" Expression ")"
| <IDENTIFIER>
PrimarySuffix ::= "." "this"
| "." AllocationExpression
| "[" "[" DistArraySecRefDimList "]" "]"
| "[" TripletOrExpressionList "]"
| "." <IDENTIFIER>
| Arguments
DistArraySecRefDimList ::= DistArraySecRefDim ( "," DistArraySecRefDim )*
DistArraySecRefDim ::= Triplet
| Expression
| KernelSubrange
Triplet ::= ( Expression )? ":" ( Expression )? ( ":" Expression )?
KernelSubrange ::= "<" ( PrimaryExpression | ":" ) ">"
| "<" KernelSubrange ">"
TripletOrExpressionList ::= TripletOrExpression ( "," TripletOrExpression )*
TripletOrExpression ::= Triplet
| Expression
Literal ::= <INTEGER_LITERAL>
| <FLOATING_POINT_LITERAL>
| <CHARACTER_LITERAL>
| <STRING_LITERAL>
| BooleanLiteral
| NullLiteral
BooleanLiteral ::= "true"
| "false"
NullLiteral ::= "null"
Arguments ::= "(" ( ArgumentList )? ")"
ArgumentList ::= Expression ( "," Expression )*
AllocationExpression ::= "new" PrimitiveType ArrayShapes
| "new" Name ( ArrayShapes | Arguments ( ClassBody )? )
ArrayShapes ::= ( AllocatedShape )+ ( ArraySignature )* ( "on" GroupExpression )?
| ( "[" "]" )+ ArrayInitializer
| "#" ( "on" GroupExpression )?
AllocatedShape ::= "[" "[" Expression ( "," Expression )* "]" "]"
| "[" Expression "]"
GroupExpression ::= PrimaryExpression ( "/" PrimaryExpression )*
Statement ::= LabeledStatement
| Block
| EmptyStatement
| StatementExpression ";"
| SwitchStatement
| IfStatement
| WhileStatement
| DoStatement
| ForStatement
| BreakStatement
| ContinueStatement
| ReturnStatement
| ThrowStatement
| SynchronizedStatement
| TryStatement
| OnStatement
| AtStatement
| OverallStatement
LabeledStatement ::= <IDENTIFIER> ":" Statement
Block ::= "{" ( BlockStatement )* "}"
BlockStatement ::= LocalVariableDeclaration ";"
| Statement
| UnmodifiedClassDeclaration
| UnmodifiedInterfaceDeclaration
LocalVariableDeclaration ::= ( "final" )? Type VariableDeclarator ( "," VariableDeclarator )*
EmptyStatement ::= ";"
StatementExpression ::= PreIncrementExpression
| PreDecrementExpression
| PrimaryExpression ( "++" | "--" | AssignmentOperator Expression )?
SwitchStatement ::= "switch" "(" Expression ")" "{" ( SwitchLabel ( BlockStatement )* )* "}"
SwitchLabel ::= "case" Expression ":"
| "default" ":"
IfStatement ::= "if" "(" Expression ")" Statement ( "else" Statement )?
WhileStatement ::= "while" "(" Expression ")" Statement
DoStatement ::= "do" Statement "while" "(" Expression ")" ";"
ForStatement ::= "for" "(" ( ForInit )? ";" ( Expression )? ";" ( ForUpdate )? ")" Statement
ForInit ::= LocalVariableDeclaration
| StatementExpressionList
StatementExpressionList ::= StatementExpression ( "," StatementExpression )*
ForUpdate ::= StatementExpressionList
BreakStatement ::= "break" ( <IDENTIFIER> )? ";"
ContinueStatement ::= "continue" ( <IDENTIFIER> )? ";"
ReturnStatement ::= "return" ( Expression )? ";"
ThrowStatement ::= "throw" Expression ";"
SynchronizedStatement ::= "synchronized" "(" Expression ")" Block
TryStatement ::= "try" Block ( "catch" "(" FormalParameter ")" Block )* ( "finally" Block )?
OnStatement ::= "on" "(" Expression ")" Statement
AtStatement ::= "at" "(" NamedLocationList ")" Statement
NamedLocationList ::= NamedLocation ( "," NamedLocation )*
NamedLocation ::= <IDENTIFIER> "=" Expression
OverallStatement ::= "overall" "(" NamedLocationList ")" Statement