CHAPTER 19: LALR(1) Java Grammar Previous
Previous
Java Language
Java Language
Index
Index
Next
Next

19.11 Productions from Chapter 14: Blocks and Statements


Block:

	{ BlockStatementsopt }

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:

	{ SwitchBlockStatementGroupsopt SwitchLabelsopt }

SwitchBlockStatementGroups:

	SwitchBlockStatementGroup

	SwitchBlockStatementGroups SwitchBlockStatementGroup

SwitchBlockStatementGroup:

	SwitchLabels BlockStatements

SwitchLabels:

	SwitchLabel

	SwitchLabels SwitchLabel

SwitchLabel:

	case ConstantExpression :

	default :

WhileStatement:

	while ( Expression ) Statement

WhileStatementNoShortIf:

	while ( Expression ) StatementNoShortIf

DoStatement:

	do Statement while ( Expression ) ;


ForStatement:

	for ( ForInitopt ; Expressionopt ; ForUpdateopt )

		Statement

ForStatementNoShortIf:

	for ( ForInitopt ; Expressionopt ; ForUpdateopt )

		StatementNoShortIf

ForInit:

	StatementExpressionList

	LocalVariableDeclaration

ForUpdate:

	StatementExpressionList

StatementExpressionList:

	StatementExpression

	StatementExpressionList , StatementExpression

BreakStatement:

	break Identifieropt ;

ContinueStatement:

	continue Identifieropt ;

ReturnStatement:

	return Expressionopt ;

ThrowStatement:

	throw Expression ;

SynchronizedStatement:

	synchronized ( Expression ) Block

TryStatement:

	try Block Catches

	try Block Catchesopt Finally

Catches:

	CatchClause

	Catches CatchClause

CatchClause:

	catch ( FormalParameter ) Block

Finally:

	finally Block



Top© 1996 Sun Microsystems, Inc. All rights reserved.