BNF for OpenJava1.0.jj

NON-TERMINALS

debug_message1 ::= java code
debug_message2 ::= java code
CompilationUnit ::= ( PackageDeclaration )? ( ImportDeclaration )* ( TypeDeclaration )* <EOF>
PackageDeclaration ::= "package" Name ";"
ImportDeclaration ::= "import" ImportedName ";"
ImportedName ::= Identifier ( "." Identifier )* ( "." "*" )?
TypeDeclaration ::= ( ( Metaclasses )? ( ClassDeclaration | InterfaceDeclaration ) | ";" )
Identifier ::= ( <IDENTIFIER> | "metaclass" )
Metaclasses ::= "metaclass" Name ( "," Name )? ( ":" | ";" )
OpenJavaModifier ::= <IDENTIFIER>
OpenJavaSuffixes ::= ( OpenJavaSuffix )+
OpenJavaSuffix ::= Identifier ( "<" Name ( "," Name )* ">" | "#" "#" | "{" "}" )
ClassDeclaration ::= ( "abstract" | "final" | "public" | OpenJavaModifier )* UnmodifiedClassDeclaration
UnmodifiedClassDeclaration ::= "class" Identifier ( OpenJavaSuffixes )? ( "extends" Name ( OpenJavaSuffixes )? )? ( "implements" NameList )? ClassBody
ClassBody ::= "{" ( ClassBodyDeclaration )* "}"
NestedClassDeclaration ::= ( Metaclasses )? ( "static" | "abstract" | "final" | "public" | "protected" | "private" | OpenJavaModifier )* UnmodifiedClassDeclaration
ClassBodyDeclaration ::= Initializer
| NestedClassDeclaration
| NestedInterfaceDeclaration
| ConstructorDeclaration
| MethodDeclaration
| FieldDeclaration
MethodDeclarationLookahead ::= ( "public" | "protected" | "private" | "static" | "abstract" | "final" | "native" | "synchronized" | OpenJavaModifier )* ResultType Identifier "("
InterfaceDeclaration ::= ( "abstract" | "public" | OpenJavaModifier )* UnmodifiedInterfaceDeclaration
NestedInterfaceDeclaration ::= ( Metaclasses )? ( "static" | "abstract" | "final" | "public" | "protected" | "private" | OpenJavaModifier )* UnmodifiedInterfaceDeclaration
UnmodifiedInterfaceDeclaration ::= "interface" Identifier ( OpenJavaSuffixes )? ( "extends" NameList )? "{" ( InterfaceMemberDeclaration )* "}"
InterfaceMemberDeclaration ::= NestedClassDeclaration
| NestedInterfaceDeclaration
| MethodDeclaration
| FieldDeclaration
FieldDeclaration ::= ( "public" | "protected" | "private" | "static" | "final" | "transient" | "volatile" | OpenJavaModifier )* Type VariableDeclarator ( "," VariableDeclarator )* ";"
VariableDeclarator ::= VariableDeclaratorId ( "=" VariableInitializer )?
VariableDeclaratorId ::= Identifier ( "[" "]" )*
VariableInitializer ::= ArrayInitializer
| Expression
ArrayInitializer ::= "{" ( VariableInitializer ( "," VariableInitializer )* )? ( "," )? "}"
MethodDeclaration ::= ( "public" | "protected" | "private" | "static" | "abstract" | "final" | "native" | "synchronized" | OpenJavaModifier )* ResultType MethodDeclarator ( "throws" NameList )? ( Block | ";" )
MethodDeclarator ::= Identifier FormalParameters ( "[" "]" )*
FormalParameters ::= "(" ( FormalParameter ( "," FormalParameter )* )? ")"
FormalParameter ::= ( "final" | OpenJavaModifier )* Type VariableDeclaratorId
ConstructorDeclaration ::= ( OpenJavaModifier )* ( ( "public" | "protected" | "private" ) ( OpenJavaModifier )* )? Identifier FormalParameters ( "throws" NameList )? "{" ( ExplicitConstructorInvocation )? ( BlockStatement )* "}"
ExplicitConstructorInvocation ::= ( "this" Arguments ";" | ( PrimaryExpression "." )? "super" Arguments ";" )
Initializer ::= ( "static" )? Block
Type ::= ( PrimitiveType | Name ) ( OpenJavaSuffixes )? ( "[" "]" )*
PrimitiveType ::= ( "boolean" | "char" | "byte" | "short" | "int" | "long" | "float" | "double" )
ResultType ::= ( "void" ( OpenJavaSuffixes )? | Type )
Name ::= Identifier ( "." Identifier )*
NameList ::= Name ( OpenJavaSuffixes )? ( "," Name ( OpenJavaSuffixes )? )*
Expression ::= AssignmentExpression
| ConditionalExpression
AssignmentExpression ::= PrimaryExpression 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 "[" "]" | "(" Name ")" ( "~" | "!" | "(" | Identifier | "this" | "super" | "new" | Literal ) | "(" Name Identifier )
PostfixExpression ::= PrimaryExpression ( "++" | "--" )?
CastExpression ::= ( "(" Type ")" UnaryExpression | "(" Type ")" UnaryExpressionNotPlusMinus )
PrimaryExpression ::= PrimaryPrefix ( PrimarySuffix )*
PrimaryPrefix ::= ( Literal | "this" | "super" "." Identifier | "(" Expression ")" | AllocationExpression | ResultType "." "class" | Name )
PrimarySuffix ::= ( "." "this" | "." AllocationExpression | "[" Expression "]" | "." Identifier | Arguments )
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 ArrayDimsAndInits | "new" Name ( OpenJavaSuffixes )? ( ArrayDimsAndInits | Arguments ( ClassBody )? ) )
ArrayDimsAndInits ::= ( ( "[" Expression "]" )+ ( "[" "]" )* | ( "[" "]" )+ ArrayInitializer )
Statement ::= LabeledStatement
| Block
| EmptyStatement
| ExpressionStatement
| SwitchStatement
| IfStatement
| WhileStatement
| DoStatement
| ForStatement
| BreakStatement
| ContinueStatement
| ReturnStatement
| ThrowStatement
| SynchronizedStatement
| TryStatement
LabeledStatement ::= Identifier ":" Statement
Block ::= "{" ( BlockStatement )* "}"
BlockStatement ::= ( LocalVariableDeclaration ";" | Statement | UnmodifiedClassDeclaration )
LocalVariableDeclaration ::= ( "final" )? Type VariableDeclarator ( "," VariableDeclarator )*
EmptyStatement ::= ";"
ExpressionStatement ::= StatementExpression ";"
StatementExpression ::= PreIncrementExpression
| PreDecrementExpression
| AssignmentExpression
| PostfixExpression
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 )?