
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 VoidInterfaceMethodDeclaratorRestInterfaceMemberDecl ::= ClassOrInterfaceDeclaration
FormalParameter ::= "final" Type VariableDeclaratorId
TypeDeclaration ::= ClassOrInterfaceDeclaration
TypeDeclaration ::=
";"MethodOrFieldDecl ::= Type Identifier MethodOrFieldRest
ConstantDeclaratorRest ::=
BracketsOpt "=" VariableInitializerStatementExpression ::= 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 StatementStatement ::= "do" Statement "while" ParExpression ";"
Statement ::= "try" Block CatchesCatches "finally" Block
Statement ::= "switch" ParExpression "{" SwitchBlockStatementGroups "}"
Statement ::=
"synchronized" ParExpression BlockStatement ::= "return" Expression ";"
Statement ::= "throw" Expression ";"
Statement ::= "break" Identifier ";"
Statement ::= "continue" Identifier ";"
Statement ::=
";"Statement ::= ExpressionStatement
Statement ::=
Identifier ":" StatementVariableDeclaratorId ::= Identifier BracketsOpt
Type ::= Identifier "." Identifier BracketsOpt
Type ::= BasicType
ArrayCreatorRest ::= "[" "]" BracketsOpt ArrayInitializerExpression "]" "[" 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 ::=
ModifierClassCreatorRest ::=
Arguments ClassBodyConstantDeclarator ::= Identifier ConstantDeclaratorRest
ClassBodyDeclaration ::=
";"ClassBodyDeclaration ::= "static" Block
ClassBodyDeclaration ::= ModifiersOpt MemberDecl
BlockStatements ::=
BlockStatementVoidInterfaceMethodDeclaratorRest ::= FormalParameters BracketsOpt "throws" QualifiedIdentifierList ";"
LocalVariableDeclarationStatement ::= "final" Type VariableDeclarators ";"
Expression1 ::=
Expression2 Expression1RestMemberDecl ::= MethodOrFieldDecl
MemberDecl ::=
"void" Identifier MethodDeclaratorRestMemberDecl ::= Identifier ConstructorDeclaratorRest
MemberDecl ::= ClassOrInterfaceDeclaration
Expression3 ::= PrefixOp Expression3
Expression3 ::= "(" ExpressionType ")" Expression3
Expression3 ::= Primary Selector PostfixOp
Expression2 ::=
Expression3 Expression2RestBracketsOpt ::= "[" "]"
MethodOrFieldRest ::= VariableDeclaratorRest
MethodOrFieldRest ::= MethodDeclaratorRest
MoreStatementExpressions ::= "," StatementExpression
SwitchBlockStatementGroups ::=
SwitchBlockStatementGroupArrayInitializer ::= "{" VariableInitializer "," VariableInitializer "," "}"
Catches ::=
CatchClause CatchClauseInterfaceMethodOrFieldRest ::=
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 ::= ModifiersOpt ClassDeclarationInterfaceDeclaration
SuperSuffix ::= Arguments
SuperSuffix ::= "." Identifier Arguments
VariableDeclaratorRest ::= BracketsOpt "=" VariableInitializer
BlockStatement ::= LocalVariableDeclarationStatement
BlockStatement ::= ClassOrInterfaceDeclaration
BlockStatement ::= Identifier ":" Statement
InterfaceBody ::= "{" InterfaceBodyDeclaration "}"
Literal ::= IntegerLiteral
Literal ::= FloatingPointLiteral
Literal ::= CharacterLiteral
Literal ::= StringLiteral
Literal ::= BooleanLiteral
Literal ::= NullLiteral
Expression ::= Expression1 AssignmentOperator 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 ::= QualifiedIdentifier ArrayCreatorRestClassCreatorRest
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" SuperSuffixPrimary ::= Literal
Primary ::=
"new" CreatorPrimary ::= 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" TypeInnerCreator ::= Identifier ClassCreatorRest
VariableDeclarator ::= Identifier VariableDeclaratorRest
ExpressionStatement ::=
StatementExpression ";"