CompilationUnit |
::= |
( ModuleDeclaration )? ( ImportDeclaration )* BehaviorDeclarationAttributes ( BehaviorDeclaration | InterfaceDeclaration ) <EOF> |
Name |
::= |
<IDENTIFIER> ( "." <IDENTIFIER> )* |
ModuleDeclaration |
::= |
"module" Name ";" |
ImportDeclaration |
::= |
"import" <IDENTIFIER> ( "." ( <IDENTIFIER> | "*" ) )* ";" |
BehaviorDeclarationAttributes |
::= |
( "abstract" | "public" | "final" )* |
InterfaceDeclaration |
::= |
"interface" <IDENTIFIER> ( "extends" Name )? ( "implements" Name ( "," Name )* )? InterfaceBody |
InterfaceBody |
::= |
( "{" ( StateVariableDeclaration | MethodLookahead ";" )* "}" )* |
BehaviorDeclaration |
::= |
"behavior" <IDENTIFIER> ( "extends" Name )? ( "implements" Name ( "," Name )* )? BehaviorBody |
MethodLookahead |
::= |
MethodAttributes ( Type | "void" ) <IDENTIFIER> FormalParameters ( "throws" Exceptions )? |
ConstructorLookahead |
::= |
MethodAttributes <IDENTIFIER> FormalParameters ( "throws" Exceptions )? "{" |
BehaviorBody |
::= |
"{" ( Initializer | NestedBehaviorDeclaration | StateVariableDeclaration | MethodDeclaration | ConstructorDeclaration )* "}" |
NestedBehaviorAttributes |
::= |
( "abstract" | "public" | "final" | "protected" | "private" | "static" )* |
NestedBehaviorDeclaration |
::= |
NestedBehaviorAttributes BehaviorDeclaration |
Initializer |
::= |
( "static" )? Block |
StateVariableAttributes |
::= |
( "public" | "protected" | "private" | "volatile" | "static" | "final" | "transient" )* |
StateVariableDeclaration |
::= |
StateVariableAttributes Type VariableDeclaration ( "," VariableDeclaration )* ";" |
PrimitiveType |
::= |
( "boolean" | "char" | "byte" | "short" | "int" | "long" | "float" | "double" ) |
Type |
::= |
( PrimitiveType | Name ) ( "[" "]" )* |
VariableDeclaration |
::= |
<IDENTIFIER> ( "[" "]" )* ( "=" ( Expression | ArrayInitializer ) )? |
ArrayInitializer |
::= |
"{" ( ( Expression | ArrayInitializer ) ( "," ( Expression | ArrayInitializer ) )* )? "}" |
AssignmentOperator |
::= |
( "=" | "*=" | "/=" | "%=" | "+=" | "-=" | "<<=" | ">>=" | ">>>=" | "&=" | "^=" | "|=" ) |
Expression |
::= |
ConditionalExpression ( AssignmentOperator Expression )? |
ConditionalExpression |
::= |
ConditionalOrExpression ( "?" Expression ":" ConditionalExpression )? |
ConditionalOrExpression |
::= |
ConditionalAndExpression ( "||" ConditionalAndExpression )* |
ConditionalAndExpression |
::= |
InclusiveOrExpression ( "&&" InclusiveOrExpression )* |
InclusiveOrExpression |
::= |
ExclusiveOrExpression ( "|" ExclusiveOrExpression )* |
ExclusiveOrExpression |
::= |
AndExpression ( "^" AndExpression )* |
AndExpression |
::= |
EqualityExpression ( "&" EqualityExpression )* |
EqualityExpression |
::= |
InstanceOfExpression ( ( "==" | "!=" ) InstanceOfExpression )* |
InstanceOfExpression |
::= |
RelationalExpression ( "instanceof" ConditionalAndExpression )* |
RelationalExpression |
::= |
ShiftExpression ( ( "<" | ">" | "<=" | ">=" ) ShiftExpression )* |
ShiftExpression |
::= |
AdditiveExpression ( ( "<<" | ">>" | ">>>" ) AdditiveExpression )* |
AdditiveExpression |
::= |
MultiplicativeExpression ( ( "+" | "-" ) ConditionalAndExpression )* |
MultiplicativeExpression |
::= |
UnaryExpression ( ( "*" | "/" | "%" ) UnaryExpression )* |
UnaryExpression |
::= |
( ( "+" | "-" ) UnaryExpression | PreIncrementExpression | PreDecrementExpression | UnaryExpressionNotPlusMinus ) |
PreIncrementExpression |
::= |
"++" PrimaryExpression |
PreDecrementExpression |
::= |
"--" PrimaryExpression |
UnaryExpressionNotPlusMinus |
::= |
( ( "~" | "!" ) UnaryExpression | CastExpression | PostfixExpression ) |
PostfixExpression |
::= |
PrimaryExpression ( "++" | "--" )? |
CastExpression |
::= |
( "(" Type ")" UnaryExpression | "(" Type ")" UnaryExpressionNotPlusMinus ) |
PrimaryExpression |
::= |
PrimaryPrefix ( PrimarySuffix )* |
ResultType |
::= |
( Type | "void" ) |
PrimaryPrefix |
::= |
( Literal | "this" | "super" | "(" Expression ")" | AllocationExpression | Name ) |
PrimarySuffix |
::= |
( Arguments | "." <IDENTIFIER> | "[" Expression "]" ) |
Literal |
::= |
( IntegerLiteral | FloatingPointLiteral | CharacterLiteral | StringLiteral | BooleanLiteral | NullLiteral | TokenLiteral ) |
IntegerLiteral |
::= |
<INTEGER_LITERAL> |
FloatingPointLiteral |
::= |
<FLOATING_POINT_LITERAL> |
CharacterLiteral |
::= |
<CHARACTER_LITERAL> |
StringLiteral |
::= |
<STRING_LITERAL> |
BooleanLiteral |
::= |
( "true" | "false" ) |
NullLiteral |
::= |
"null" |
TokenLiteral |
::= |
"token" |
Arguments |
::= |
"(" ( Expression ( "," Expression )* )? ")" |
AllocationExpression |
::= |
( "new" PrimitiveType ArrayDimsAndInits | "new" Name ( ArrayDimsAndInits | ( Arguments ( BehaviorBody )? ) ) ) |
ArrayDimsAndInits |
::= |
( ( "[" Expression "]" )+ ( "[" "]" )* | ( "[" "]" )+ ArrayInitializer ) |
FormalParameters |
::= |
"(" ( ( "final" )? Type <IDENTIFIER> ( "[" "]" )* ( "," ( "final" )? Type <IDENTIFIER> ( "[" "]" )* )* )? ")" |
ExplicitConstructorInvocation |
::= |
( "this" Arguments ";" | ( PrimaryExpression "." )? "super" Arguments ";" ) |
ConstructorDeclaration |
::= |
MethodAttributes <IDENTIFIER> FormalParameters ( "throws" Exceptions )? "{" ( ExplicitConstructorInvocation )? ( Statement )* "}" |
ConstructorAttributes |
::= |
( "public" | "protected" | "private" )* |
MethodDeclaration |
::= |
MethodAttributes ( Type | "void" ) <IDENTIFIER> FormalParameters ( "throws" Exceptions )? Block |
MethodAttributes |
::= |
( "public" | "protected" | "private" | "static" | "abstract" | "final" | "native" )* |
Exceptions |
::= |
Name ( "," Name )* |
Statement |
::= |
( ContinuationStatement | TokenDeclarationStatement | LocalVariableDeclaration ";" | Block | EmptyStatement | StatementExpression ";" | LabeledStatement | SynchronizedStatement | SwitchStatement | IfStatement | WhileStatement | DoStatement | ForStatement | BreakStatement | ContinueStatement | ReturnStatement | ThrowStatement | TryStatement | MethodDeclaration | NestedBehaviorDeclaration ) |
Block |
::= |
"{" ( Statement )* "}" |
LocalVariableDeclaration |
::= |
( "final" )? Type VariableDeclaration ( "," VariableDeclaration )* |
EmptyStatement |
::= |
";" |
StatementExpression |
::= |
( PreIncrementExpression | PreDecrementExpression | PrimaryExpression ) ( "++" | "--" | AssignmentOperator Expression )? |
LabeledStatement |
::= |
<IDENTIFIER> ":" Statement |
SwitchStatement |
::= |
"switch" "(" Expression ")" "{" ( SwitchLabel ( Statement )* )* "}" |
SwitchLabel |
::= |
( "case" Expression ":" | "default" ":" ) |
IfStatement |
::= |
"if" "(" Expression ")" Statement ( "else" Statement )? |
WhileStatement |
::= |
"while" "(" Expression ")" Statement |
DoStatement |
::= |
"do" Statement "while" "(" Expression ")" ";" |
ForInit |
::= |
( LocalVariableDeclaration | ( StatementExpression ( "," StatementExpression )* ) )? |
ForCondition |
::= |
( Expression )? |
ForIncrement |
::= |
( StatementExpression ( "," StatementExpression )* )? |
ForStatement |
::= |
"for" "(" ForInit ";" ForCondition ";" ForIncrement ")" Statement |
BreakStatement |
::= |
"break" ( <IDENTIFIER> )? ";" |
ContinueStatement |
::= |
"continue" ( <IDENTIFIER> )? ";" |
ReturnStatement |
::= |
"return" ( Expression )? ";" |
ThrowStatement |
::= |
"throw" Expression ";" |
SynchronizedStatement |
::= |
"synchronized" "(" Expression ")" Block |
TryStatement |
::= |
"try" Block ( "catch" "(" ( "final" )? Type <IDENTIFIER> ")" Block )* ( "finally" Block )? |
ContinuationStatement |
::= |
( MessageStatement "@" )* ( MessageStatement | "currentContinuation" ) ";" |
MessageStatement |
::= |
( NamedTokenStatement )? ( MessageSend | JoinBlock ) |
JoinBlock |
::= |
"join" Block |
NamedTokenStatement |
::= |
( <IDENTIFIER> | "token" <IDENTIFIER> ) "=" |
MessageSend |
::= |
( PrimaryExpression "<-" )? <IDENTIFIER> MessageArguments ( ":" MessageProperty )? |
MessageProperty |
::= |
<IDENTIFIER> ( Arguments )? |
MessageArguments |
::= |
"(" ( Expression ( "," Expression )* )? ")" |
TokenDeclarationStatement |
::= |
"token" <IDENTIFIER> "=" Expression ";" |