Grammatik: 1. Ausdrücke Primary: Literal Variable IncDecExpression ( Expression ) MethodInvocation Variable: Identifier { [ Expression ] } Identifier: [ Identifier . ] Name IncDecExpression: Variable IncDec IncDec Variable IncDec: ++ | -- Expression: UnaryExpression BinaryExpression ConditionalExpression AssignmentExpression MethodInvocation CreationExpression UnaryExpression: Primary UnaryOperator UnaryExpression UnaryOperator + | - | ! | ... BinaryExpression: Expression BinaryOperator Expression BinaryOperator: + | - | * | / | & | && | | | || | ... AssignmentExpression: Variable AssignmentOperator Expression AssignmentOperator: = | += | -= | *= | /= | ... MethodInvocation: Method ( [ ActualArguments ] ) Method: Identifier ActualArguments: Expression { , Expression } CreationExpression: new ClassIdentifier ( [ ActualArguments ] ) 2. Anweisungen Statement: SimpleStatement CompositeStatement Label : Statement SimpleStatement: EmptyStatement ExpressionStatement JumpStatement EmptyStatement ; ExpressionStatement: StatementExpression ; StatementExpression: AssignmentExpression IncDecExpression MethodInvocation CreationExpression JumpStatement: BreakStatement ContinueStatement ReturnStatement BreakStatement break [ Label ] ; ContinueStatement: continue [ Label ] ; ReturnStatement. return [ Expression ] ; Label: Name CompositeStatement: Block CaseStatement RepetitiveStatement Block: { { VariableDeclaration | Statement } } VariableDeclaration [ final ] Type VariableDeclarators ; VariableDeclarators VariableDeclarator { , VariableDeclarator } VariableDeclarator Name [ = Expression ] Type: PrimitiveType ClassType PrimitiveType: Name ClassType: Identifier CaseStatement: ConditionalStatement SwitchStatement RepetitiveStatement WhileStatement DoStatement ForStatement ConditionalStatement: if ( Expression ) Statement [ else Statement ] SwitchStatement: switch ( Expression ) SwitchBlock SwitchBlock: { { CaseGroup } } CaseGroup: SwitchLabel { SwitchLabel } StatementSequence SwitchLabel: case ConstantExpression : default : ConstantExpression: Expression WhileStatement: while ( Expression ) Statement DoStatement: do Statement while ( Expression ) ; ForStatement: for ( [ Initialization ] ; [ Expression ] ; [ Update ] ) Statement Initialization: StatementExpression { , StatementExpression } VariableDeclaration Update: StatementExpression { , StatementExpression } 3. Methoden MethodDeclaration: MethodHeader MethodBody MethodHeader: { Modifier } ResultType MethodDeclarator Modifier: public | static | ... ResultType: Type | void MethodDeclarator: Identifier ( [ FormalArguments ] ) FormalArguments: FormalArgument { , FormalArgument } FormalArgument: Type Name MethodBody: ; | Block 4. Klassen ClassDeclaration: [ public ] class Name ClassBody ClassBody: { { { Modifier } Declaration } } Declaration: FieldDeclaration MethodDeclaration ClassDeclaration ConstructorDeclaration Initializer FieldDeclaration: VariableDeclaration ConstructorDeclaration: [ public ] Name ( [ FormalArguments ] ) Block Initializer: [ static ] Block