Grammar connected by Vadim Zaytsev, see the Grammar Zoo entry for details: java/java-2/jls/impl/connected
Source used for this grammar: James Gosling, Bill Joy, Guy Steele, Gilad Bracha, Java Language Specification, 2nd edition, 1998, §18: Syntax, pages 449–456 [HTML] [PDF]
ConstantExpression
, PrefixOp
, SwitchLabel
, VariableInitializer
, InterfaceMemberDecl
, FormalParameter
, TypeDeclaration
, MethodOrFieldDecl
, ConstantDeclaratorRest
, StatementExpression
, InterfaceDeclaration
, QualifiedIdentifierList
, Arguments
, Statement
, VariableDeclaratorId
, Type
, ArrayCreatorRest
, Modifier
, InterfaceMethodOrFieldDecl
, ImportDeclaration
, CompilationUnit
, BasicType
, CatchClause
, Selector
, ModifiersOpt
, ClassCreatorRest
, ConstantDeclarator
, ClassBodyDeclaration
, BlockStatements
, VoidInterfaceMethodDeclaratorRest
, LocalVariableDeclarationStatement
, Expression1
, MemberDecl
, Expression3
, Expression2
, BracketsOpt
, MethodOrFieldRest
, MoreStatementExpressions
, SwitchBlockStatementGroups
, ArrayInitializer
, Catches
, InterfaceMethodOrFieldRest
, Expression1Rest
, Infixop
, MethodDeclaratorRest
, InterfaceBodyDeclaration
, QualifiedIdentifier
, ConstantDeclaratorsRest
, ClassOrInterfaceDeclaration
, SuperSuffix
, VariableDeclaratorRest
, BlockStatement
, InterfaceBody
, Literal
, Expression
, SwitchBlockStatementGroup
, Block
, PostfixOp
, InterfaceMethodDeclaratorRest
, IdentifierSuffix
, ForUpdate
, ForInit
, Creator
, AssignmentOperator
, ParExpression
, VariableDeclarators
, ClassBody
, Primary
, ConstructorDeclaratorRest
, FormalParameters
, TypeList
, MethodBody
, ClassDeclaration
, Expression2Rest
, InnerCreator
, VariableDeclarator
, ExpressionStatement
), 1 root (CompilationUnit
), 0 top (—), 7 bottom (IntegerLiteral
, Identifier
25, NullLiteral
, BooleanLiteral
, CharacterLiteral
, FloatingPointLiteral
, StringLiteral
).ConstantExpression ::= Expression
PrefixOp ::=
"++"
PrefixOp ::=
"--"
PrefixOp ::=
"!"
PrefixOp ::=
"~"
PrefixOp ::=
"+"
PrefixOp ::=
"-"
SwitchLabel ::= "case" ConstantExpression ":"
SwitchLabel ::= "default" ":"
VariableInitializer ::= ArrayInitializer
VariableInitializer ::= Expression
InterfaceMemberDecl ::= InterfaceMethodOrFieldDecl
InterfaceMemberDecl ::=
"void" Identifier VoidInterfaceMethodDeclaratorRest
InterfaceMemberDecl ::= ClassOrInterfaceDeclaration
FormalParameter ::= "final" Type VariableDeclaratorId
TypeDeclaration ::= ClassOrInterfaceDeclaration
TypeDeclaration ::=
";"
MethodOrFieldDecl ::= Type Identifier MethodOrFieldRest
ConstantDeclaratorRest ::=
BracketsOpt "=" VariableInitializer
StatementExpression ::= Expression
InterfaceDeclaration ::= "interface" Identifier "extends" TypeList InterfaceBody
QualifiedIdentifierList ::= QualifiedIdentifier "," QualifiedIdentifier
Arguments ::= "(" Expression "," Expression ")"
Statement ::= Block
Statement ::= "if" ParExpression Statement "else" Statement
Statement ::= "for" "(" ForInit ";" Expression ";" ForUpdate ")" Statement
Statement ::=
"while" ParExpression Statement
Statement ::= "do" Statement "while" ParExpression ";"
Statement ::= "try" Block Catches Catches "finally" Block
Statement ::= "switch" ParExpression "{" SwitchBlockStatementGroups "}"
Statement ::=
"synchronized" ParExpression Block
Statement ::= "return" Expression ";"
Statement ::= "throw" Expression ";"
Statement ::= "break" Identifier ";"
Statement ::= "continue" Identifier ";"
Statement ::=
";"
Statement ::= ExpressionStatement
Statement ::=
Identifier ":" Statement
VariableDeclaratorId ::= Identifier BracketsOpt
Type ::= Identifier "." Identifier BracketsOpt
Type ::= BasicType
ArrayCreatorRest ::= "[" "]" BracketsOpt ArrayInitializer Expression "]" "[" Expression "]" BracketsOpt
Modifier ::=
"public"
Modifier ::=
"protected"
Modifier ::=
"private"
Modifier ::=
"static"
Modifier ::=
"abstract"
Modifier ::=
"final"
Modifier ::=
"native"
Modifier ::=
"synchronized"
Modifier ::=
"transient"
Modifier ::=
"volatile"
Modifier ::=
"strictfp"
InterfaceMethodOrFieldDecl ::= Type Identifier InterfaceMethodOrFieldRest
ImportDeclaration ::= "import" Identifier "." Identifier "." "*" ";"
CompilationUnit ::= "package" QualifiedIdentifier ";" ImportDeclaration TypeDeclaration
BasicType ::=
"byte"
BasicType ::=
"short"
BasicType ::=
"char"
BasicType ::=
"int"
BasicType ::=
"long"
BasicType ::=
"float"
BasicType ::=
"double"
BasicType ::=
"boolean"
CatchClause ::= "catch" "(" FormalParameter ")" Block
Selector ::= "." Identifier Arguments
Selector ::= "." "this"
Selector ::= "." "super" SuperSuffix
Selector ::= "." "new" InnerCreator
Selector ::= "[" Expression "]"
ModifiersOpt ::=
Modifier
ClassCreatorRest ::=
Arguments ClassBody
ConstantDeclarator ::= Identifier ConstantDeclaratorRest
ClassBodyDeclaration ::=
";"
ClassBodyDeclaration ::= "static" Block
ClassBodyDeclaration ::= ModifiersOpt MemberDecl
BlockStatements ::=
BlockStatement
VoidInterfaceMethodDeclaratorRest ::= FormalParameters BracketsOpt "throws" QualifiedIdentifierList ";"
LocalVariableDeclarationStatement ::= "final" Type VariableDeclarators ";"
Expression1 ::=
Expression2 Expression1Rest
MemberDecl ::= MethodOrFieldDecl
MemberDecl ::=
"void" Identifier MethodDeclaratorRest
MemberDecl ::= Identifier ConstructorDeclaratorRest
MemberDecl ::= ClassOrInterfaceDeclaration
Expression3 ::= PrefixOp Expression3
Expression3 ::= "(" Expression Type ")" Expression3
Expression3 ::= Primary SelectorPostfixOp
Expression2 ::=
Expression3 Expression2Rest
BracketsOpt ::= "[" "]"
MethodOrFieldRest ::= VariableDeclaratorRest
MethodOrFieldRest ::= MethodDeclaratorRest
MoreStatementExpressions ::= "," StatementExpression
SwitchBlockStatementGroups ::=
SwitchBlockStatementGroup
ArrayInitializer ::= "{" VariableInitializer "," VariableInitializer "," "}"
Catches ::=
CatchClause CatchClause
InterfaceMethodOrFieldRest ::=
ConstantDeclaratorsRest ";"
InterfaceMethodOrFieldRest ::= InterfaceMethodDeclaratorRest
Expression1Rest ::= "?" Expression ":" Expression1
Infixop ::=
"||"
Infixop ::=
"&&"
Infixop ::=
"|"
Infixop ::=
"^"
Infixop ::=
"&"
Infixop ::=
"=="
Infixop ::=
"!="
Infixop ::=
"<"
Infixop ::=
">"
Infixop ::=
"<="
Infixop ::=
">="
Infixop ::=
"<<"
Infixop ::=
">>"
Infixop ::=
">>>"
Infixop ::=
"+"
Infixop ::=
"-"
Infixop ::=
"*"
Infixop ::=
"/"
Infixop ::=
"%"
MethodDeclaratorRest ::= FormalParameters BracketsOpt "throws" QualifiedIdentifierList MethodBody";"
InterfaceBodyDeclaration ::=
";"
InterfaceBodyDeclaration ::= ModifiersOpt InterfaceMemberDecl
QualifiedIdentifier ::= Identifier "." Identifier
ConstantDeclaratorsRest ::= ConstantDeclaratorRest "," ConstantDeclarator
ClassOrInterfaceDeclaration ::= ModifiersOptClassDeclaration InterfaceDeclaration
SuperSuffix ::= Arguments
SuperSuffix ::= "." Identifier Arguments
VariableDeclaratorRest ::= BracketsOpt "=" VariableInitializer
BlockStatement ::= LocalVariableDeclarationStatement
BlockStatement ::= ClassOrInterfaceDeclaration
BlockStatement ::= ":" StatementIdentifier
InterfaceBody ::= "{" InterfaceBodyDeclaration "}"
Literal ::= IntegerLiteral
Literal ::= FloatingPointLiteral
Literal ::= CharacterLiteral
Literal ::= StringLiteral
Literal ::= BooleanLiteral
Literal ::= NullLiteral
Expression ::= Expression1AssignmentOperator Expression1
SwitchBlockStatementGroup ::= SwitchLabel BlockStatements
Block ::= "{" BlockStatements "}"
PostfixOp ::=
"++"
PostfixOp ::=
"--"
InterfaceMethodDeclaratorRest ::= FormalParameters BracketsOpt "throws" QualifiedIdentifierList ";"
IdentifierSuffix ::= "[" "]" BracketsOpt "." "class" Expression "]"
IdentifierSuffix ::= Arguments
IdentifierSuffix ::= "." "class""this""super" Arguments"new" InnerCreator
ForUpdate ::= StatementExpression MoreStatementExpressions
ForInit ::= StatementExpression MoreStatementExpressions
ForInit ::= "final" Type VariableDeclarators
Creator ::= QualifiedIdentifierArrayCreatorRest ClassCreatorRest
AssignmentOperator ::=
"="
AssignmentOperator ::=
"+="
AssignmentOperator ::=
"-="
AssignmentOperator ::=
"*="
AssignmentOperator ::=
"/="
AssignmentOperator ::=
"&="
AssignmentOperator ::=
"|="
AssignmentOperator ::=
"^="
AssignmentOperator ::=
"%="
AssignmentOperator ::=
"<<="
AssignmentOperator ::=
">>="
AssignmentOperator ::=
">>>="
ParExpression ::= "(" Expression ")"
VariableDeclarators ::= VariableDeclarator "," VariableDeclarator
ClassBody ::= "{" ClassBodyDeclaration "}"
Primary ::= "(" Expression ")"
Primary ::= "this" Arguments
Primary ::=
"super" SuperSuffix
Primary ::= Literal
Primary ::=
"new" Creator
Primary ::= Identifier "." Identifier IdentifierSuffix
Primary ::= BasicType BracketsOpt "." "class"
Primary ::= "void" "." "class"
ConstructorDeclaratorRest ::= FormalParameters "throws" QualifiedIdentifierList MethodBody
FormalParameters ::= "(" FormalParameter "," FormalParameter ")"
TypeList ::= Type "," Type
MethodBody ::= Block
ClassDeclaration ::= "class" Identifier "extends" Type "implements" TypeList ClassBody
Expression2Rest ::=Infixop Expression3
Expression2Rest ::=
"instanceof" Type
InnerCreator ::= Identifier ClassCreatorRest
VariableDeclarator ::= Identifier VariableDeclaratorRest
ExpressionStatement ::=
StatementExpression ";"