Browsable Java Abstract Syntax Grammar

CC-BY

Grammar extracted by Vadim Zaytsev, see the Grammar Zoo entry for details: java/eclipse/jdt/extracted
Source used for this grammar: Mikaël Barbero, JavaAbstractSyntax 1.0, a metamodel describing a full abstract syntax of the code, based on the Eclipse JDT API Specification, JavaAbstractSyntax.ecore, 2006/10/24 [Atlantic]

Summary

Syntax

String ::=
	string
Boolean ::=
	"true"
	"false"
Integer ::=
	integer
AST ::=
	[root]::α
ASTNode ::=
	AnonymousClassDeclaration
ASTNode ::=
	BodyDeclaration
ASTNode ::=
	CatchClause
ASTNode ::=
	Comment
ASTNode ::=
	CompilationUnit
ASTNode ::=
	Expression
ASTNode ::=
	ImportDeclaration
ASTNode ::=
	MemberRef
ASTNode ::=
	MemberValuePair
ASTNode ::=
	MethodRef
ASTNode ::=
	MethodRefParameter
ASTNode ::=
	PackageDeclaration
ASTNode ::=
	Statement
ASTNode ::=
	TagElement
ASTNode ::=
	TextElement
ASTNode ::=
	Type
ASTNode ::=
	TypeParameter
ASTNode ::=
	VariableDeclaration
ASTNode ::=
	Modifier
AnonymousClassDeclaration ::=
	[bodyDeclarations]::α+
BodyDeclaration ::=
	AbstractTypeDeclaration
BodyDeclaration ::=
	AnnotationTypeMemberDeclaration
BodyDeclaration ::=
	EnumConstantDeclaration
BodyDeclaration ::=
	FieldDeclaration
BodyDeclaration ::=
	Initializer
BodyDeclaration ::=
	MethodDeclaration
CatchClause ::=
	[body]::α [exception]::α
Comment ::=
	BlockComment
Comment ::=
	Javadoc
Comment ::=
	LineComment
CompilationUnit ::=
	[comments]::α+ [package]::α [imports]::α+ [types]::α+
Expression ::=
	ArrayAccess
Expression ::=
	ArrayCreation
Expression ::=
	ArrayInitializer
Expression ::=
	Assignment
Expression ::=
	BooleanLiteral
Expression ::=
	CastExpression
Expression ::=
	CharacterLiteral
Expression ::=
	ClassInstanceCreation
Expression ::=
	ConditionalExpression
Expression ::=
	FieldAccess
Expression ::=
	InfixExpression
Expression ::=
	InstanceofExpression
Expression ::=
	MethodInvocation
Expression ::=
	Name
Expression ::=
	NullLiteral
Expression ::=
	NumberLiteral
Expression ::=
	ParenthesizedExpression
Expression ::=
	PostfixExpression
Expression ::=
	PrefixExpression
Expression ::=
	StringLiteral
Expression ::=
	SuperFieldAccess
Expression ::=
	SuperMethodInvocation
Expression ::=
	ThisExpression
Expression ::=
	TypeLiteral
Expression ::=
	VariableDeclarationExpression
Expression ::=
	Annotation
ImportDeclaration ::=
	[onDemand]::α [static]::α [name]::α
MemberRef ::=
	[name]::α [qualifier]::α
MemberValuePair ::=
	[name]::α [value]::α
MethodRef ::=
	[name]::α [qualifier]::α [parameters]::α+
MethodRefParameter ::=
	[name]::α [type]::α [varargs]::α
ExtendedModifier ::=
	Modifier
ExtendedModifier ::=
	Annotation
Modifier ::=
	[abstract]::α [final]::α [native]::α [none]::α [private]::α [protected]::α [public]::α [static]::α [strictfp]::α [synchronized]::α [transient]::α [volatile]::α
PackageDeclaration ::=
	[annotations]::α+ [javadoc]::α [name]::α
Statement ::=
	AssertStatement
Statement ::=
	Block
Statement ::=
	BreakStatement
Statement ::=
	ConstructorInvocation
Statement ::=
	ContinueStatement
Statement ::=
	DoStatement
Statement ::=
	EmptyStatement
Statement ::=
	EnhancedForStatement
Statement ::=
	ExpressionStatement
Statement ::=
	ForStatement
Statement ::=
	IfStatement
Statement ::=
	LabeledStatement
Statement ::=
	ReturnStatement
Statement ::=
	SuperConstructorInvocation
Statement ::=
	SwitchCase
Statement ::=
	SwitchStatement
Statement ::=
	SynchronizedStatement
Statement ::=
	ThrowStatement
Statement ::=
	TryStatement
Statement ::=
	TypeDeclarationStatement
Statement ::=
	VariableDeclarationStatement
Statement ::=
	WhileStatement
TagElement ::=
	[fragments]::α+ [tagName]::α [nested]::α
TextElement ::=
	[text]::α
Type ::=
	ArrayType
Type ::=
	ParameterizedType
Type ::=
	PrimitiveType
Type ::=
	QualifiedType
Type ::=
	SimpleType
Type ::=
	WildcardType
TypeParameter ::=
	[name]::α [typeBounds]::α+
VariableDeclaration ::=
	SingleVariableDeclaration
VariableDeclaration ::=
	VariableDeclarationFragment
AbstractTypeDeclaration ::=
	AnnotationTypeDeclaration
AbstractTypeDeclaration ::=
	EnumDeclaration
AbstractTypeDeclaration ::=
	TypeDeclaration
AnnotationTypeMemberDeclaration ::=
	[default]::α [name]::α [type]::α
EnumConstantDeclaration ::=
	[arguments]::α+ [anonymousClassDeclaration]::α [name]::α
FieldDeclaration ::=
	[fragments]::α+ [type]::α
Initializer ::=
	[body]::α
MethodDeclaration ::=
	[body]::α [extraDimensions]::α [name]::α [returnType]::α [constructor]::α [varargs]::α [parameters]::α+ [thrownExceptions]::α+ [typeParameters]::α+
AnnotationTypeDeclaration ::=
	[bodyDeclarations]::α+ [name]::α [localTypeDeclaration]::α [memberTypeDeclaration]::α [packageMemberTypeDeclaration]::α
EnumDeclaration ::=
	[superInterfaceTypes]::α+ [enumConstants]::α+
TypeDeclaration ::=
	[superclassType]::α [interface]::α [superInterfaceTypes]::α+ [typeParameters]::α+
BlockComment ::=
	[alternateRoot]::α
Javadoc ::=
	[tags]::α+
LineComment ::=
	[alternateRoot]::α
Annotation ::=
	MarkerAnnotation
Annotation ::=
	NormalAnnotation
Annotation ::=
	SingleMemberAnnotation
ArrayAccess ::=
	[array]::α [index]::α
ArrayCreation ::=
	[dimensions]::α+ [initializer]::α [type]::α
ArrayInitializer ::=
	[expressions]::α+
Assignment ::=
	[leftHandSide]::α [operator]::α [rightHandSide]::α
AssignementOperatorKind ::=
	[RIGHT_SHIFT_SIGNED_ASSIGN]::ε
	[BIT_XOR_ASSIGN]::ε
	[TIMES_ASSIGN]::ε
	[LEFT_SHIFT_ASSIGN]::ε
	[MINUS_ASSIGN]::ε
	[BIT_OR_ASSIGN]::ε
	[PLUS_ASSIGN]::ε
	[ASSIGN]::ε
	[RIGHT_SHIFT_UNSIGNED_ASSIGN]::ε
	[REMAINDER_ASSIGN]::ε
	[DIVIDE_ASSIGN]::ε
	[BIT_AND_ASSIGN]::ε
BooleanLiteral ::=
	[booleanValue]::α
CastExpression ::=
	[expression]::α [type]::α
CharacterLiteral ::=
	[charValue]::α [escapedValue]::α
ClassInstanceCreation ::=
	[arguments]::α+ [anonymousClassDeclaration]::α [expression]::α [type]::α [typeArguments]::α+
ConditionalExpression ::=
	[elseExpression]::α [expression]::α [thenExpression]::α
FieldAccess ::=
	[expression]::α [name]::α
InfixExpression ::=
	[extendedOperands]::α+ [leftOperand]::α [operator]::α [rightOperand]::α
InfixExpressionOperatorKind ::=
	[GREATER_EQUALS]::ε
	[OR]::ε
	[RIGHT_SHIFT_SIGNED]::ε
	[MINUS]::ε
	[XOR]::ε
	[LESS_EQUALS]::ε
	[EQUALS]::ε
	[NOT_EQUALS]::ε
	[AND]::ε
	[PLUS]::ε
	[GREATER]::ε
	[CONDITIONAL_OR]::ε
	[REMAINDER]::ε
	[LESS]::ε
	[LEFT_SHIFT]::ε
	[RIGHT_SHIFT_UNSIGNED]::ε
	[CONDITIONAL_AND]::ε
	[TIMES]::ε
	[DIVIDE]::ε
InstanceofExpression ::=
	[leftOperand]::α [rightOperand]::α
MethodInvocation ::=
	[arguments]::α+ [expression]::α [name]::α [typeArguments]::α+
Name ::=
	QualifiedName
Name ::=
	SimpleName
NullLiteral ::=
	[resolveBoxing]::α [resolveUnboxing]::α
NumberLiteral ::=
	[token]::α
ParenthesizedExpression ::=
	[expression]::α
PostfixExpression ::=
	[operand]::α [operator]::α
PostfixExpresssionOperatorKind ::=
	[INCREMENT]::ε
	[DECREMENT]::ε
PrefixExpression ::=
	[operand]::α [operator]::α
PrefixExpresssionOperatorKind ::=
	[MINUS]::ε
	[NOT]::ε
	[DECREMENT]::ε
	[COMPLEMENT]::ε
	[INCREMENT]::ε
	[PLUS]::ε
StringLiteral ::=
	[escapedValue]::α [literalValue]::α
SuperFieldAccess ::=
	[name]::α [qualifier]::α
SuperMethodInvocation ::=
	[arguments]::α+ [name]::α [qualifier]::α [typeArguments]::α+
ThisExpression ::=
	[qualifier]::α
TypeLiteral ::=
	[type]::α
VariableDeclarationExpression ::=
	[fragments]::α+ [modifiers]::α+ [type]::α
AssertStatement ::=
	[expression]::α [message]::α
Block ::=
	[statements]::α+
BreakStatement ::=
	[label]::α
ConstructorInvocation ::=
	[arguments]::α+ [typeArguments]::α+
ContinueStatement ::=
	[label]::α
DoStatement ::=
	[body]::α [expression]::α
EmptyStatement ::=
	ε
EnhancedForStatement ::=
	[body]::α [expression]::α [parameter]::α
ExpressionStatement ::=
	[expression]::α
ForStatement ::=
	[body]::α [expression]::α [initializers]::α+ [updaters]::α+
IfStatement ::=
	[elseStatement]::α [expression]::α [thenStatement]::α
LabeledStatement ::=
	[body]::α [label]::α
ReturnStatement ::=
	[expression]::α
SuperConstructorInvocation ::=
	[arguments]::α+ [expression]::α [typeArguments]::α+
SwitchCase ::=
	[expression]::α [default]::α
SwitchStatement ::=
	[expression]::α [statements]::α+
SynchronizedStatement ::=
	[body]::α [expression]::α
ThrowStatement ::=
	[expression]::α
TryStatement ::=
	[catchClauses]::α+ [body]::α [finally]::α
TypeDeclarationStatement ::=
	[declaration]::α
VariableDeclarationStatement ::=
	[fragments]::α+ [modifiers]::α+ [type]::α
WhileStatement ::=
	[body]::α [expression]::α
ArrayType ::=
	[componentType]::α [dimensions]::α [elementType]::α
ParameterizedType ::=
	[type]::α [typeArguments]::α+
PrimitiveType ::=
	[code]::α
QualifiedType ::=
	[name]::α [qualifier]::α
SimpleType ::=
	[name]::α
WildcardType ::=
	[bound]::α [upperBound]::α
SingleVariableDeclaration ::=
	[type]::α [varargs]::α [modifiers]::α+
VariableDeclarationFragment ::=
	[extraDimensions]::α [initializer]::α [name]::α
QualifiedName ::=
	[name]::α [qualifier]::α
SimpleName ::=
	[identifier]::α [declaration]::α
MarkerAnnotation ::=
	[typeName]::α
NormalAnnotation ::=
	[values]::α+
SingleMemberAnnotation ::=
	[value]::α

GrammarLabMaintained by Dr. Vadim Zaytsev a.k.a. @grammarware. Last updated in September 2015. []