Chapter 19. Syntax
This chapter repeats the syntactic grammar given in Chapters 4, 6-10, 14, and 15, as well as key parts of the lexical grammar from Chapter 3, using the notation from §2.4.
Productions from §3 (Lexical Structure)
Identifier:
IdentifierChars:
JavaLetter:
any Unicode character that is a "Java letter"
JavaLetterOrDigit:
any Unicode character that is a "Java letter-or-digit"
Productions from §4 (Types, Values, and Variables)
Type:
PrimitiveType:
NumericType:
IntegralType:
(one of)
byte short int long char FloatingPointType:
(one of)
float double ReferenceType:
ClassOrInterfaceType:
ClassType:
InterfaceType:
TypeVariable:
ArrayType:
Dims:
TypeParameter:
TypeParameterModifier:
TypeBound:
AdditionalBound:
TypeArguments:
TypeArgumentList:
TypeArgument:
Wildcard:
WildcardBounds:
Productions from §6 (Names)
TypeName:
PackageOrTypeName:
ExpressionName:
MethodName:
PackageName:
AmbiguousName:
Productions from §7 (Packages)
CompilationUnit:
PackageDeclaration:
PackageModifier:
SingleTypeImportDeclaration:
TypeImportOnDemandDeclaration:
SingleStaticImportDeclaration:
StaticImportOnDemandDeclaration:
TypeDeclaration:
Productions from §8 (Classes)
ClassDeclaration:
NormalClassDeclaration:
ClassModifier:
TypeParameters:
TypeParameterList:
Superclass:
extends ClassType Superinterfaces:
implements InterfaceTypeList InterfaceTypeList:
ClassBody:
ClassBodyDeclaration:
ClassMemberDeclaration:
FieldDeclaration:
FieldModifier:
VariableDeclaratorList:
VariableDeclarator:
VariableDeclaratorId:
VariableInitializer:
UnannType:
UnannPrimitiveType:
UnannReferenceType:
UnannClassOrInterfaceType:
UnannClassType:
UnannInterfaceType:
UnannTypeVariable:
UnannArrayType:
MethodDeclaration:
MethodModifier:
MethodHeader:
Result:
MethodDeclarator:
FormalParameterList:
FormalParameters:
FormalParameter:
VariableModifier:
LastFormalParameter:
ReceiverParameter:
Throws:
throws ExceptionTypeList ExceptionTypeList:
ExceptionType:
MethodBody:
InstanceInitializer:
StaticInitializer:
static Block ConstructorDeclaration:
ConstructorModifier:
ConstructorDeclarator:
SimpleTypeName:
ConstructorBody:
ExplicitConstructorInvocation:
[TypeArguments]
[TypeArguments]
ExpressionName
Primary
this ( [ArgumentList] ) ; [TypeArguments]
super ( [ArgumentList] ) ; ExpressionName
. [TypeArguments] super ( [ArgumentList] ) ; Primary
. [TypeArguments] super ( [ArgumentList] ) ; EnumDeclaration:
EnumBody:
EnumConstantList:
EnumConstant:
EnumConstantModifier:
EnumBodyDeclarations:
Productions from §9 (Interfaces)
InterfaceDeclaration:
NormalInterfaceDeclaration:
InterfaceModifier:
ExtendsInterfaces:
extends InterfaceTypeList InterfaceBody:
InterfaceMemberDeclaration:
ConstantDeclaration:
ConstantModifier:
InterfaceMethodDeclaration:
InterfaceMethodModifier:
AnnotationTypeDeclaration:
AnnotationTypeBody:
AnnotationTypeMemberDeclaration:
AnnotationTypeElementDeclaration:
AnnotationTypeElementModifier:
DefaultValue:
default ElementValue Annotation:
NormalAnnotation:
ElementValuePairList:
ElementValuePair:
ElementValue:
ElementValueArrayInitializer:
ElementValueList:
MarkerAnnotation:
@ TypeName SingleElementAnnotation:
Productions from §14 (Blocks and Statements)
Block:
BlockStatements:
BlockStatement:
LocalVariableDeclarationStatement:
LocalVariableDeclaration:
StatementWithoutTrailingSubstatement:
EmptyStatement:
; LabeledStatement:
LabeledStatementNoShortIf:
ExpressionStatement:
IfThenStatement:
IfThenElseStatement:
IfThenElseStatementNoShortIf:
AssertStatement:
SwitchStatement:
SwitchBlock:
SwitchBlockStatementGroup:
SwitchLabels:
SwitchLabel:
EnumConstantName:
WhileStatement:
WhileStatementNoShortIf:
DoStatement:
ForStatement:
ForStatementNoShortIf:
BasicForStatement:
BasicForStatementNoShortIf:
ForUpdate:
StatementExpressionList:
EnhancedForStatement:
EnhancedForStatementNoShortIf:
BreakStatement:
ContinueStatement:
ReturnStatement:
ThrowStatement:
SynchronizedStatement:
Catches:
CatchClause:
CatchFormalParameter:
CatchType:
Finally:
finally Block TryWithResourcesStatement:
ResourceSpecification:
Resource:
Productions from §15 (Expressions)
Primary:
PrimaryNoNewArray:
ClassLiteral:
ClassInstanceCreationExpression:
UnqualifiedClassInstanceCreationExpression:
ClassOrInterfaceTypeToInstantiate:
TypeArgumentsOrDiamond:
FieldAccess:
ArrayAccess:
MethodInvocation:
MethodName
TypeName
ExpressionName
Primary
TypeName
( [ArgumentList] ) TypeName
. [TypeArguments] Identifier ( [ArgumentList] ) ExpressionName
. [TypeArguments] Identifier ( [ArgumentList] ) Primary
. [TypeArguments] Identifier ( [ArgumentList] ) super . [TypeArguments] Identifier ( [ArgumentList] ) TypeName
. super . [TypeArguments] Identifier ( [ArgumentList] ) ArgumentList:
MethodReference:
ExpressionName
ReferenceType
Primary
TypeName
ClassType
ArrayType
:: [TypeArguments] Identifier ReferenceType
:: [TypeArguments] Identifier Primary
:: [TypeArguments] Identifier super :: [TypeArguments] Identifier TypeName
. super :: [TypeArguments] Identifier ClassType
:: [TypeArguments] new ArrayType
:: new ArrayCreationExpression:
DimExpr:
Expression:
LambdaExpression:
LambdaParameters:
InferredFormalParameterList:
LambdaBody:
AssignmentExpression:
Assignment:
LeftHandSide:
AssignmentOperator:
(one of)
=*=/=%=+=-=<<=>>=>>>=&=^=|=
ConditionalExpression:
ConditionalOrExpression:
ConditionalAndExpression:
InclusiveOrExpression:
ExclusiveOrExpression:
AndExpression:
EqualityExpression:
RelationalExpression:
ShiftExpression:
AdditiveExpression:
MultiplicativeExpression:
PreIncrementExpression:
PreDecrementExpression:
UnaryExpressionNotPlusMinus:
PostfixExpression:
PostIncrementExpression:
PostDecrementExpression:
CastExpression:
ConstantExpression:
© Oracle and/or its affiliates. All rights reserved.
Licensed under the Oracle Technology Network License Agreement.