Ява
Описание подготовлено А. Полысаевым
Goal = CompilationUnit.
Literal = IntegerLiteral | FloatingPointLiteral |
BooleanLiteral | CharacterLiteral |
StringLiteral | NullLiteral.
IntegerLiteral = DecimalIntegerLiteral | HexIntegerLiteral |
OctalIntegerLiteral.
DecimalIntegerLiteral = DecimalNumeral [ IntegerTypeSuffix ].
HexIntegerLiteral = HexNumeral [ IntegerTypeSuffix ].
OctalIntegerLiteral = OctalNumeral [ IntegerTypeSuffix ].
IntegerTypeSuffix = "l" | "L".
DecimalNumeral = "0" | NonZeroDigit [ Digits ].
Digits = Digit | Digits Digit.
Digit = "0" | NonZeroDigit.
NonZeroDigit = "1" |"2" |"3" |"4" |"5" |"6" |"7" |"8" |"9".
HexNumeral = "0" "x" HexDigit | "0" "X" HexDigit |
HexNumeral HexDigit.
HexDigit = "0"| "1"| "2"| "3"| "4"| "5"| "6"|
"7"| "8"| "9"| "a"| "b"| "c"| "d"|
"e"| "f"| "A"| "B"| "C"| "D"| "E"| "F".
OctalNumeral = "0" OctalDigit | OctalNumeral OctalDigit.
OctalDigit = "0"| "1"| "2"| "3"| "4"| "5"| "6"| "7".
FloatingPointLiteral = Digits "." [ Digits ] [ ExponentPart ]
[ FloatTypeSuffix ] | "." Digits
[ ExponentPart ] [ FloatTypeSuffix ] |
Digits ExponentPart [ FloatTypeSuffix ] |
Digits [ ExponentPart ] FloatTypeSuffix.
ExponentPart = ExponentIndicator SignedInteger.
ExponentIndicator = "e" | "E".
SignedInteger = [ Sign ] Digits.
Sign = "+" | "-".
FloatTypeSuffix = "f" | "F" | "d" | "D".
BooleanLiteral = TRUE | FALSE.
CharacterLiteral = "'" SingleCharacter "'" | "'" EscapeSequence "'".
SingleCharacter = InputCharacter.
InputCharacter = UnicodeInputCharacter.
UnicodeInputCharacter = UnicodeEscape | rawinputcharacter.
UnicodeEscape = "\" UnicodeMarker HexDigit
HexDigit HexDigit HexDigit.
UnicodeMarker = "u" | UnicodeMarker "u".
HexDigit = "0"| "1"| "2"| "3"| "4"| "5"| "6"|
"7"| "8"| "9"| "a"| "b"| "c"| "d"| "e"| "f" |
"A"| "B"| "C"| "D"| "E"| "F".
StringLiteral = '"' [ StringCharacters ] '"'.
StringCharacters = StringCharacter | StringCharacters StringCharacter.
StringCharacter = InputCharacter | EscapeSequence.
EscapeSequence = "\b" | "\t" | "\n" |
"\f" | "\r" | '\"' |
"\'" | "\\" | OctalEscape.
OctalEscape = "\" OctalDigit | "\" OctalDigit OctalDigit |
"\" ZeroToThree OctalDigit OctalDigit.
OctalDigit = "0"| "1"| "2"| "3"| "4"| "5"| "6"| "7".
ZeroToThree = "0"| "1"| "2"| "3".
NullLiteral = NULL.
Type = PrimitiveType | ReferenceType.
PrimitiveType = NumericType | BOOLEAN.
NumericType = IntegralType | FloatingPointType.
IntegralType = BYTE | SHORT | INT | LONG | CHAR.
FloatingPointType = FLOAT | DOUBLE.
ReferenceType = ClassOrInterfaceType | ArrayType.
ClassOrInterfaceType = Name.
ClassType = ClassOrInterfaceType.
InterfaceType = ClassOrInterfaceType.
ArrayType = PrimitiveType "[" "]" |
Name "[" "]" | ArrayType "[" "]".
Name = SimpleName | QualifiedName.
SimpleName = Identifier.
QualifiedName = Name "." Identifier.
CompilationUnit = [ PackageDeclaration ] [ ImportDeclarations ]
[ TypeDeclarations ].
ImportDeclarations = ImportDeclaration | ImportDeclarations ImportDeclaration.
TypeDeclarations = TypeDeclaration | TypeDeclarations TypeDeclaration.
PackageDeclaration = PACKAGE Name ";".
ImportDeclaration = SingleTypeImportDeclaration |
TypeImportOnDemandDeclaration.
SingleTypeImportDeclaration = IMPORT Name ";".
TypeImportOnDemandDeclaration = IMPORT Name "." "*" ";".
TypeDeclaration = ClassDeclaration | InterfaceDeclaration | ";".
Modifiers = Modifier | Modifiers Modifier.
Modifier = PUBLIC | PROTECTED | PRIVATE |
STATIC | ABSTRACT | FINAL | NATIVE |
SYNCHRONIZED | TRANSIENT | VOLATILE.
ClassDeclaration = [ Modifiers ] CLASS Identifier [ Super ]
[ Interfaces ] ClassBody.
Super = EXTENDS ClassType.
Interfaces = IMPLEMENTS InterfaceTypeList.
InterfaceTypeList = InterfaceType | InterfaceTypeList "," InterfaceType.
ClassBody = "{" [ ClassBodyDeclarations ] "}".
ClassBodyDeclarations = ClassBodyDeclaration |
ClassBodyDeclarations ClassBodyDeclaration.
ClassBodyDeclaration = ClassMemberDeclaration | StaticInitializer |
ConstructorDeclaration.
ClassMemberDeclaration = FieldDeclaration | MethodDeclaration.
FieldDeclaration = [ Modifiers ] Type VariableDeclarators ";".
VariableDeclarators = VariableDeclarator |
VariableDeclarators "," VariableDeclarator.
VariableDeclarator = VariableDeclaratorId |
VariableDeclaratorId "=" VariableInitializer.
VariableDeclaratorId = Identifier | VariableDeclaratorId "[" "]".
VariableInitializer = Expression | ArrayInitializer.
MethodDeclaration = MethodHeader MethodBody.
MethodHeader = [ Modifiers ] Type MethodDeclarator [ Throws ] |
[ Modifiers ] VOID MethodDeclarator [ Throws ].
MethodDeclarator = Identifier "(" FormalParameterList ")" |
MethodDeclarator "[" "]".
FormalParameterList = FormalParameter |
FormalParameterList "," FormalParameter.
FormalParameter = Type VariableDeclaratorId.
Throws = THROWS ClassTypeList.
ClassTypeList = ClassType | ClassTypeList "," ClassType.
MethodBody = Block | ";".
StaticInitializer = STATIC Block.
ConstructorDeclaration = [ Modifiers ] ConstructorDeclarator
[ Throws ] ConstructorBody.
ConstructorDeclarator = SimpleName "(" [ FormalParameterList ] ")".
ConstructorBody = "{" [ ExplicitConstructorInvocation ]
[ BlockStatements ] "}".
ExplicitConstructorInvocation = THIS "(" [ ArgumentList ] ")" ";" |
SUPER "(" [ ArgumentList ] ")" ";".
InterfaceDeclaration = [ Modifiers ] INTERFACE Identifier
[ ExtendsInterfaces ] InterfaceBody.
ExtendsInterfaces = EXTENDS InterfaceType |
ExtendsInterfaces "," InterfaceType.
InterfaceBody = "{" [ InterfaceMemberDeclarations ] "}".
InterfaceMemberDeclarations = InterfaceMemberDeclaration |
InterfaceMemberDeclarations
InterfaceMemberDeclaration.
InterfaceMemberDeclaration = ConstantDeclaration |
AbstractMethodDeclaration.
ConstantDeclaration = FieldDeclaration.
AbstractMethodDeclaration = MethodHeader ";".
ArrayInitializer = "{" [ VariableInitializers ] [ "," ] "}".
VariableInitializers = VariableInitializer |
VariableInitializers "," VariableInitializer.
Block = "{" [ BlockStatements ] "}".
BlockStatements = BlockStatement | BlockStatements BlockStatement.
BlockStatement = LocalVariableDeclarationStatement | Statement.
LocalVariableDeclarationStatement = LocalVariableDeclaration ";".
LocalVariableDeclaration = Type VariableDeclarators.
Statement = StatementWithoutTrailingSubstatement |
LabeledStatement | IfThenStatement |
IfThenElseStatement | WhileStatement |
ForStatement.
StatementNoShortIf = StatementWithoutTrailingSubstatement |
LabeledStatementNoShortIf |
IfThenElseStatementNoShortIf |
WhileStatementNoShortIf |
ForStatementNoShortIf.
StatementWithoutTrailingSubstatement = Block | EmptyStatement |
ExpressionStatement |
SwitchStatement | DoStatement |
BreakStatement | ContinueStatement |
ReturnStatement |
SynchronizedStatement |
ThrowStatement | TryStatement.
EmptyStatement = ";".
LabeledStatement = Identifier ":" Statement.
LabeledStatementNoShortIf = Identifier ":" StatementNoShortIf.
ExpressionStatement = StatementExpression ";".
StatementExpression = Assignment | PreIncrementExpression |
PreDecrementExpression | PostIncrementExpression |
PostDecrementExpression | MethodInvocation |
ClassInstanceCreationExpression.
IfThenStatement = IF "(" Expression ")" Statement.
IfThenElseStatement = IF "(" Expression ")" StatementNoShortIf
ELSE Statement.
IfThenElseStatementNoShortIf = IF "(" Expression ")" StatementNoShortIf
ELSE StatementNoShortIf.
SwitchStatement = SWITCH "(" Expression ")" SwitchBlock.
SwitchBlock = "{" [ SwitchBlockStatementGroups ]
[ SwitchLabels ] "}".
SwitchBlockStatementGroups = SwitchBlockStatementGroup |
SwitchBlockStatementGroups SwitchBlockStatementGroup.
SwitchBlockStatementGroup = SwitchLabels BlockStatements.
SwitchLabels = SwitchLabel | SwitchLabels SwitchLabel.
SwitchLabel = CASE ConstantExpression ":" |
DEFAULT ":".
ConstantExpression = Expression.
WhileStatement = WHILE "(" Expression ")" Statement.
WhileStatementNoShortIf = WHILE "(" Expression ")" StatementNoShortIf.
DoStatement = DO Statement WHILE "(" Expression ")" ";".
ForStatement = FOR "(" [ ForInit ] ";" [ Expression ] ";"
[ ForUpdate ] ")" | Statement.
ForStatementNoShortIf = FOR "(" [ ForInit ] ";" [ Expression ] ";"
[ ForUpdate ] ")" | StatementNoShortIf.
ForInit = StatementExpressionList | LocalVariableDeclaration.
ForUpdate = StatementExpressionList.
StatementExpressionList = StatementExpression |
StatementExpressionList "," StatementExpression.
BreakStatement = BREAK [ Identifier ] ";".
ContinueStatement = CONTINUE [ Identifier ] ";".
ReturnStatement = RETURN [ Expression ] ";".
ThrowStatement = THROW Expression ";".
SynchronizedStatement = SYNCHRONIZED "(" Expression ")" Block.
TryStatement = TRY Block Catches | TRY Block [ Catches ] Finally.
Catches = CatchClause | Catches CatchClause.
CatchClause = CATCH "(" FormalParameter ")" Block.
Finally = FINALLY Block.
Primary = PrimaryNoNewArray | ArrayCreationExpression.
PrimaryNoNewArray = Literal | THIS | "(" Expression ")" |
ClassInstanceCreationExpression |
FieldAccess | MethodInvocation | ArrayAccess.
ClassInstanceCreationExpression = NEW ClassType "(" [ ArgumentList ] ")".
ArgumentList = Expression | ArgumentList "," Expression.
ArrayCreationExpression = NEW PrimitiveType DimExprs [ Dims ] |
NEW ClassOrInterfaceType DimExprs [ Dims ].
DimExprs = DimExpr | DimExprs DimExpr.
DimExpr = "[" Expression "]".
Dims = "[" "]" | Dims "[" "]".
FieldAccess = Primary "."Identifier | SUPER "." Identifier.
MethodInvocation = Name "(" [ ArgumentList ] ")" |
Primary "." Identifier "(" [ ArgumentList ] ")" |
SUPER "." Identifier "(" [ ArgumentList ] ")".
ArrayAccess = Name "[" Expression "]" |
PrimaryNoNewArray "[" Expression "]".
PostfixExpression = Primary | Name | PostIncrementExpression |
PostDecrementExpression.
PostIncrementExpression = PostfixExpression "++".
PostDecrementExpression = PostfixExpression "--".
UnaryExpression = PreIncrementExpression | PreDecrementExpression |
"+" UnaryExpression | "-" UnaryExpression |
UnaryExpressionNotPlusMinus.
PreIncrementExpression = "++" UnaryExpression.
PreDecrementExpression = "--" UnaryExpression.
UnaryExpressionNotPlusMinus = PostfixExpression | "~" UnaryExpression |
"!" UnaryExpression | CastExpression.
CastExpression = "(" PrimitiveType [ Dims ] ")" UnaryExpression |
"(" Expression ")" UnaryExpressionNotPlusMinus |
"(" Name Dims ")" UnaryExpressionNotPlusMinus.
MultiplicativeExpression = UnaryExpression |
MultiplicativeExpression "*" UnaryExpression |
MultiplicativeExpression "/" UnaryExpression |
MultiplicativeExpression "%" UnaryExpression.
AdditiveExpression = MultiplicativeExpression |
AdditiveExpression "+" MultiplicativeExpression |
AdditiveExpression "-" MultiplicativeExpression.
ShiftExpression = AdditiveExpression |
ShiftExpression "<<" AdditiveExpression |
ShiftExpression ">>" AdditiveExpression |
ShiftExpression ">>>" AdditiveExpression.
RelationalExpression = ShiftExpression |
RelationalExpression "<" ShiftExpression |
RelationalExpression ">" ShiftExpression |
RelationalExpression "<=" ShiftExpression |
RelationalExpression ">=" ShiftExpression |
RelationalExpression INSTANCEOF ReferenceType.
EqualityExpression = RelationalExpression |
EqualityExpression "==" RelationalExpression |
EqualityExpression "!=" RelationalExpression.
AndExpression = EqualityExpression |
AndExpression "&" EqualityExpression.
ExclusiveOrExpression = AndExpression |
ExclusiveOrExpression "^" AndExpression.
InclusiveOrExpression = ExclusiveOrExpression |
InclusiveOrExpression "|" ExclusiveOrExpression.
ConditionalAndExpression = InclusiveOrExpression |
ConditionalAndExpression "&&" InclusiveOrExpression.
ConditionalOrExpression = ConditionalAndExpression |
ConditionalOrExpression "||" ConditionalAndExpression.
ConditionalExpression = ConditionalOrExpression |
ConditionalOrExpression "?"
Expression ":" ConditionalExpression.
AssignmentExpression = ConditionalExpression | Assignment.
Assignment = LeftHandSide AssignmentOperator
AssignmentExpression.
LeftHandSide = Name | FieldAccess | ArrayAccess.
AssignmentOperator = "=" | "*=" | "/=" | "%=" | "+=" | "-="
| "<<=" | ">>=" | ">>>=" | "&=" | "^=" | "|=".
Expression = AssignmentExpression.
Identifier = IdentifierChars.
IdentifierChars = JavaLetter | IdentifierChars JavaLetterOrDigit.
JavaLetter = "A"|"B"|"C"|"D"|"E"|"F"|"G"|"I"|"J"|"K"|
"L"|"M"|"N"|"O"|"P"|"Q"|"R"|"S"|"T"|"U"|
"V"|"W"|"X"|"Y"|"Z"|"a"|"b"|"c"|"d"|"e"|
"f"|"g"|"h"|"i"|"j"|"k"|"l"|"m"|"n"|"o"|
"p"|"q"|"r"|"s"|"t"|"u"|"v"|"w"|"x"|"y"|
"z"|"_"|"$".
JavaLetterOrDigit = "1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"9"|"0".