Grammar extracted by Vadim Zaytsev, see the Grammar Zoo entry for details: java/java-4/kooiker/extracted
Source used for this grammar: Taeke Kooiker, java/syntax/*.sdf
, October 2006 [MetaEnv]
Top-sort
, CompilationUnits
, CompilationUnit
, PackageDeclaration
, Name
, Type
, PrimitiveType
, NumericType
, IntegralType
, FloatingPointType
, ReferenceType
, ClassOrInterfaceType
, ArrayType
, Identifier
, ImportDeclaration
, SingleTypeImportDeclaration
, TypeImportOnDemandDeclaration
, TypeDeclaration
, ClassDeclaration
, Modifier
, Super
, ClassType
, Interfaces
, InterfaceType
, ClassBody
, ClassBodyDeclaration
, ClassMemberDeclaration
, FieldDeclaration
, VariableDeclarator
, VariableDeclaratorId
, VariableInitializer
, Expression
, Primary
, PrimaryNoNewArray
, Literal
, IntegerLiteral
, LongLiteral
, ClassInstanceCreationExpression
, FieldAccess
, MethodInvocation
, ArrayAccess
, ArrayCreationExpression
, DimExpr
, Dim
, DimExprInitialized
, ArrayInitializer
, StatementExpression
, Assignment
, LeftHandSide
, AssignmentOperator
, MethodDeclaration
, MethodHeader
, MethodRes
, MethodDeclarator
, FormalParameter
, Throws
, MethodBody
, Block
, BlockStatement
, LocalVariableDeclarationStatement
, LocalVariableDeclaration
, Statement
, StatementWithoutTrailingSubstatement
, EmptyStatement
, ExpressionStatement
, SwitchStatement
, SwitchBlock
, SwitchBlockStatementGroup
, SwitchLabel
, DoStatement
, BreakStatement
, ContinueStatement
, ReturnStatement
, SynchronizedStatement
, ThrowStatement
, TryStatement
, CatchClause
, Finally
, LabeledStatement
, IfThenStatement
, IfThenElseStatement
, StatementNoShortIf
, LabeledStatementNoShortIf
, WhileStatementNoShortIf
, WhileStatement
, ForStatement
, ForInit
, StatementExpressionList
, ForUpdate
, AssertStatement
, StaticInitializer
, ConstructorDeclaration
, ConstructorDeclarator
, SimpleName
, ConstructorBody
, ExplicitConstructorInvocation
, InterfaceDeclaration
, ExtendsInterfaces
, InterfaceBody
, InterfaceMemberDeclaration
, ConstantDeclaration
, AbstractMethodDeclaration
), 1 root (Top-sort
), 0 top (—), 15 bottom (DoubleLiteral
, StringLiteral
, IfThenElseStatementNoShortIf
, OctalIntegerLiteral
, HexLongLiteral
, ForStatementNoShortIf
, HexIntegerLiteral
, OctalLongLiteral
, NullLiteral
, BooleanLiteral
, CharacterLiteral
, FloatingPointLiteral
, DecimalIntegerLiteral
, DecimalLongLiteral
, NatCon
).Top-sort ::= CompilationUnits
CompilationUnits ::=
CompilationUnit
CompilationUnit ::= PackageDeclarationImportDeclaration TypeDeclaration
PackageDeclaration ::= "package" Name ";"
Name ::= Type "." "class"
Name ::= Identifier "." Identifier
Type ::= PrimitiveType
Type ::= ReferenceType
PrimitiveType ::= NumericType
PrimitiveType ::=
"boolean"
NumericType ::= IntegralType
NumericType ::= FloatingPointType
IntegralType ::=
"byte"
IntegralType ::=
"short"
IntegralType ::=
"int"
IntegralType ::=
"long"
IntegralType ::=
"char"
FloatingPointType ::=
"float"
FloatingPointType ::=
"double"
ReferenceType ::= ClassOrInterfaceType
ReferenceType ::= ArrayType
ClassOrInterfaceType ::= Name
ArrayType ::= PrimitiveType "[" "]"
ArrayType ::= Name "[" "]"
ArrayType ::= ArrayType "[" "]"
Identifier ::=
"@" NatCon
ImportDeclaration ::= SingleTypeImportDeclaration
ImportDeclaration ::= TypeImportOnDemandDeclaration
SingleTypeImportDeclaration ::= "import" Name ";"
TypeImportOnDemandDeclaration ::= "import" Name "." "*" ";"
TypeDeclaration ::= ClassDeclaration
TypeDeclaration ::= InterfaceDeclaration
TypeDeclaration ::=
";"
ClassDeclaration ::= Modifier"class" Identifier Super Interfaces ClassBody
Modifier ::=
"public"
Modifier ::=
"protected"
Modifier ::=
"private"
Modifier ::=
"static"
Modifier ::=
"abstract"
Modifier ::=
"final"
Modifier ::=
"native"
Modifier ::=
"synchronized"
Modifier ::=
"transient"
Modifier ::=
"volatile"
Super ::=
"extends" ClassType
ClassType ::= ClassOrInterfaceType
Interfaces ::= "implements" InterfaceType "," InterfaceType
InterfaceType ::= ClassOrInterfaceType
ClassBody ::= "{" ClassBodyDeclaration "}"
ClassBodyDeclaration ::= ClassMemberDeclaration
ClassBodyDeclaration ::= StaticInitializer
ClassBodyDeclaration ::= ConstructorDeclaration
ClassBodyDeclaration ::=
";"
ClassBodyDeclaration ::= ClassDeclaration
ClassBodyDeclaration ::= InterfaceDeclaration
ClassMemberDeclaration ::= FieldDeclaration
ClassMemberDeclaration ::= MethodDeclaration
ClassMemberDeclaration ::= Block
FieldDeclaration ::= Modifier"," VariableDeclarator ";"Type VariableDeclarator
VariableDeclarator ::= VariableDeclaratorId
VariableDeclarator ::=
VariableDeclaratorId "=" VariableInitializer
VariableDeclaratorId ::= Identifier
VariableDeclaratorId ::= VariableDeclaratorId "[" "]"
VariableInitializer ::= Expression
VariableInitializer ::= ArrayInitializer
Expression ::= Primary
Expression ::=
"+" Expression
Expression ::=
"-" Expression
Expression ::=
"~" Expression
Expression ::=
"!" Expression
Expression ::= "(" PrimitiveType Dim ")" Expression
Expression ::= "(" Type ")" Expression
Expression ::= "(" Name Dim ")" Expression
Expression ::=
Expression "*" Expression
Expression ::=
Expression "/" Expression
Expression ::=
Expression "%" Expression
Expression ::=
Expression "+" Expression
Expression ::=
Expression "-" Expression
Expression ::=
Expression "<<" Expression
Expression ::=
Expression ">>" Expression
Expression ::=
Expression ">>>" Expression
Expression ::=
Expression "<" Expression
Expression ::=
Expression ">" Expression
Expression ::=
Expression "<=" Expression
Expression ::=
Expression ">=" Expression
Expression ::=
Expression "instanceof" ReferenceType
Expression ::=
Expression "==" Expression
Expression ::=
Expression "!=" Expression
Expression ::=
Expression "&" Expression
Expression ::=
Expression "^" Expression
Expression ::=
Expression "|" Expression
Expression ::=
Expression "&&" Expression
Expression ::=
Expression "||" Expression
Expression ::= Expression "?" Expression ":" Expression
Expression ::= StatementExpression
Expression ::= Assignment
Expression ::=
"+" Expression
Expression ::=
"-" Expression
Expression ::=
"~" Expression
Expression ::=
"!" Expression
Expression ::=
Expression "<" Expression
Expression ::=
Expression ">" Expression
Expression ::=
Expression "<=" Expression
Expression ::=
Expression ">=" Expression
Primary ::= PrimaryNoNewArray
Primary ::= ArrayCreationExpression
PrimaryNoNewArray ::= Literal
PrimaryNoNewArray ::=
"this"
PrimaryNoNewArray ::= Name "." "this"
PrimaryNoNewArray ::= "(" Expression ")"
PrimaryNoNewArray ::= ClassInstanceCreationExpression
PrimaryNoNewArray ::= FieldAccess
PrimaryNoNewArray ::= MethodInvocation
PrimaryNoNewArray ::= ArrayAccess
Literal ::= IntegerLiteral
Literal ::= LongLiteral
Literal ::= FloatingPointLiteral
Literal ::= DoubleLiteral
Literal ::= BooleanLiteral
Literal ::= CharacterLiteral
Literal ::= StringLiteral
Literal ::= NullLiteral
IntegerLiteral ::= DecimalIntegerLiteral
IntegerLiteral ::= HexIntegerLiteral
IntegerLiteral ::= OctalIntegerLiteral
LongLiteral ::= DecimalLongLiteral
LongLiteral ::= HexLongLiteral
LongLiteral ::= OctalLongLiteral
ClassInstanceCreationExpression ::= "new" ClassType "(" Expression "," Expression ")"
ClassInstanceCreationExpression ::= "new" ClassType "(" Expression "," Expression ")" ClassBody
FieldAccess ::= Name
FieldAccess ::=
Primary "." Identifier
FieldAccess ::= "super" "." Identifier
MethodInvocation ::= Name "(" Expression "," Expression ")"
MethodInvocation ::= Primary "." Identifier "(" Expression "," Expression ")"
MethodInvocation ::=
Primary "." ClassInstanceCreationExpression
MethodInvocation ::= "super" "." Identifier "(" Expression "," Expression ")"
ArrayAccess ::= Name "[" Expression "]"
ArrayAccess ::= PrimaryNoNewArray "[" Expression "]"
ArrayCreationExpression ::= "new" PrimitiveType DimExpr Dim
ArrayCreationExpression ::= "new" ClassOrInterfaceType DimExpr Dim
ArrayCreationExpression ::= "new" PrimitiveType DimExprInitialized ArrayInitializer
ArrayCreationExpression ::= "new" ClassOrInterfaceType DimExprInitialized ArrayInitializer
DimExpr ::= "[" Expression "]"
Dim ::= "[" "]"
DimExprInitialized ::= "[" Expression "]"
ArrayInitializer ::= "{" VariableInitializer "," VariableInitializer "," "}"
StatementExpression ::=
Expression "++"
StatementExpression ::=
Expression "--"
StatementExpression ::=
"++" Expression
StatementExpression ::=
"--" Expression
StatementExpression ::= Assignment
StatementExpression ::=
Expression "++"
StatementExpression ::=
Expression "--"
StatementExpression ::=
"++" Expression
StatementExpression ::=
"--" Expression
StatementExpression ::= MethodInvocation
StatementExpression ::= ClassInstanceCreationExpression
Assignment ::= LeftHandSide AssignmentOperator Expression
LeftHandSide ::= FieldAccess
LeftHandSide ::= ArrayAccess
AssignmentOperator ::=
"="
AssignmentOperator ::=
"*="
AssignmentOperator ::=
"/="
AssignmentOperator ::=
"%="
AssignmentOperator ::=
"+="
AssignmentOperator ::=
"-="
AssignmentOperator ::=
"<<="
AssignmentOperator ::=
">>="
AssignmentOperator ::=
">>>="
AssignmentOperator ::=
"&="
AssignmentOperator ::=
"^="
AssignmentOperator ::=
"|="
MethodDeclaration ::= MethodHeader MethodBody
MethodHeader ::= ModifierMethodRes MethodDeclarator Throws
MethodRes ::=
"void"
MethodRes ::= Type
MethodDeclarator ::= Identifier "(" FormalParameter "," FormalParameter ")"
MethodDeclarator ::= MethodDeclarator "[" "]"
FormalParameter ::=
Modifier
Type VariableDeclaratorIdThrows ::= "throws" ClassType "," ClassType
MethodBody ::= Block
MethodBody ::=
";"
Block ::= "{" BlockStatement "}"
BlockStatement ::=
Modifier
LocalVariableDeclarationStatementBlockStatement ::= Statement
LocalVariableDeclarationStatement ::=
LocalVariableDeclaration ";"
LocalVariableDeclaration ::= Type "," VariableDeclaratorVariableDeclarator
Statement ::= StatementWithoutTrailingSubstatement
Statement ::= LabeledStatement
Statement ::= IfThenStatement
Statement ::= IfThenElseStatement
Statement ::= WhileStatement
Statement ::= ForStatement
Statement ::= ClassDeclaration
Statement ::= AssertStatement
StatementWithoutTrailingSubstatement ::= Block
StatementWithoutTrailingSubstatement ::= EmptyStatement
StatementWithoutTrailingSubstatement ::= ExpressionStatement
StatementWithoutTrailingSubstatement ::= SwitchStatement
StatementWithoutTrailingSubstatement ::= DoStatement
StatementWithoutTrailingSubstatement ::= BreakStatement
StatementWithoutTrailingSubstatement ::= ContinueStatement
StatementWithoutTrailingSubstatement ::= ReturnStatement
StatementWithoutTrailingSubstatement ::= SynchronizedStatement
StatementWithoutTrailingSubstatement ::= ThrowStatement
StatementWithoutTrailingSubstatement ::= TryStatement
EmptyStatement ::=
";"
ExpressionStatement ::=
StatementExpression ";"
SwitchStatement ::= "switch" "(" Expression ")" SwitchBlock
SwitchBlock ::= "{" SwitchBlockStatementGroup SwitchLabel "}"
SwitchBlockStatementGroup ::= SwitchLabelBlockStatement
SwitchLabel ::= "case" Expression ":"
SwitchLabel ::= "default" ":"
DoStatement ::= "do" Statement "while" "(" Expression ")" ";"
BreakStatement ::= "break" Identifier ";"
ContinueStatement ::= "continue" Identifier ";"
ReturnStatement ::= "return" Expression ";"
SynchronizedStatement ::= "synchronized" "(" Expression ")" Block
ThrowStatement ::= "throw" Expression ";"
TryStatement ::= "try" Block CatchClause
TryStatement ::= "try" Block CatchClause Finally
CatchClause ::= "catch" "(" FormalParameter ")" Block
Finally ::=
"finally" Block
LabeledStatement ::=
Identifier ":" Statement
IfThenStatement ::= "if" "(" Expression ")" Statement
IfThenElseStatement ::= "if" "(" Expression ")" StatementNoShortIf "else" Statement
StatementNoShortIf ::= StatementWithoutTrailingSubstatement
StatementNoShortIf ::= LabeledStatementNoShortIf
StatementNoShortIf ::= IfThenElseStatementNoShortIf
StatementNoShortIf ::= WhileStatementNoShortIf
StatementNoShortIf ::= ForStatementNoShortIf
LabeledStatementNoShortIf ::=
Identifier ":" StatementNoShortIf
WhileStatementNoShortIf ::= "while" "(" Expression ")" StatementNoShortIf
WhileStatement ::= "while" "(" Expression ")" Statement
ForStatement ::= "for" "(" ForInit ";" Expression ";" ForUpdate ")" Statement
ForInit ::= StatementExpressionList
ForInit ::= LocalVariableDeclaration
StatementExpressionList ::= StatementExpression "," StatementExpression
ForUpdate ::= StatementExpressionList
AssertStatement ::= "assert" Expression ";"
StaticInitializer ::=
"static" Block
ConstructorDeclaration ::= ModifierConstructorDeclarator Throws ConstructorBody
ConstructorDeclarator ::= SimpleName "(" FormalParameter "," FormalParameter ")"
SimpleName ::= Identifier
ConstructorBody ::= "{" ExplicitConstructorInvocation BlockStatement "}"
ExplicitConstructorInvocation ::= "this" "(" Expression "," Expression ")" ";"
ExplicitConstructorInvocation ::= "super" "(" Expression "," Expression ")" ";"
InterfaceDeclaration ::= Modifier"interface" Identifier ExtendsInterfaces InterfaceBody
ExtendsInterfaces ::= "extends" InterfaceType "," InterfaceType
InterfaceBody ::= "{" InterfaceMemberDeclaration "}"
InterfaceMemberDeclaration ::= ConstantDeclaration
InterfaceMemberDeclaration ::= AbstractMethodDeclaration
InterfaceMemberDeclaration ::= InterfaceDeclaration
InterfaceMemberDeclaration ::= ClassDeclaration
ConstantDeclaration ::= FieldDeclaration
AbstractMethodDeclaration ::=
MethodHeader ";"