Grammar extracted by Vadim Zaytsev, see the Grammar Zoo entry for details: java/java-5/landman/extracted
Source used for this grammar: Davy Landman, lang::java::syntax::Java15
, June 2013 [GitHub]
LocalVarDec
, TypeParams
, Literal
, ClassMod
, ClassDecHead
, ClassDec
, SwitchGroup
, ClassBodyDec
, FloatType
, ClassMemberDec
, ConstantMod
, ConstantDec
, SwitchBlock
, CondMid
, WildcardBound
, EnumDecHead
, PackageOrTypeName
, InterfaceDecHead
, IntType
, VarInit
, EnumBodyDecs
, ClassType
, ExtendsInterfaces
, StaticInit
, FormalParam
, EnumConstArgs
, LocalVarDecStm
, CompilationUnit
, EnumConst
, NumType
, MethodDecHead
, Anno
, FieldDec
, FieldMod
, ArraySubscript
, FloatLiteral
, ConstrBody
, PackageName
, FieldAccess
, ConstrInv
, IntLiteral
, InterfaceMemberDec
, ElemValPair
, CatchClause
, ArrayInit
, VarDecId
, Modifier
, ElemVal
, ConstrDec
, ConstrMod
, InterfaceType
, PackageDec
, ArrayAccess
, ImportDec
, ArrayBaseType
, TypeName
, SwitchLabel
, ConstrHead
, Stm
, NullLiteral
, ExceptionType
, ResultType
, Expr
, ArrayType
, ClassBody
, TypeDecSpec
, PrimType
, EnumDec
, ActualTypeArg
, MethodName
, InterfaceDec
, InterfaceMod
, ClassLiteral
, StringLiteral
, AbstractMethodMod
, AbstractMethodDec
, Id
, TypeBound
, AnnoElemDec
, BoolLiteral
, MethodBody
, ExprName
, DefaultVal
, MethodDec
, AmbName
, MethodMod
, ArrayCreationExpr
, RefType
, TypeDec
, TypeArgs
, LHS
, AnnoDecHead
, TypeParam
, MethodSpec
, Type
, Super
, CharLiteral
, InstanceInit
, EnumBody
, Throws
, Block
, TypeVar
, TypeVarId
, Dim
, BlockStm
, DimExpr
, Interfaces
, VarMod
, VarDec
, ClassOrInterfaceType
), 0 root (—), 12 top (ClassMod
, ConstantMod
, CompilationUnit
, FieldMod
, FieldAccess
, Modifier
, ConstrMod
, ArrayAccess
, InterfaceMod
, MethodMod
, TypeVar
, VarMod
), 0 bottom (—).[localVarDec]
, [typeParams]
, [classDecHead]
, [classDec]
, [switchGroup]
, [double]
, [float]
2, [semicolon]
4, [constantDec]
, [switchBlock]
, [wildcardUpperBound]
, [wildcardLowerBound]
, [enumDecHead]
, [packageOrTypeName]
2, [interfaceDecHead]
, [int]
, [byte]
, [long]
, [short]
, [char]
, [enumBodyDecs]
, [classType]
, [extendsInterfaces]
, [staticInit]
, [varArityParam]
, [param]
, [localVarDecStm]
, [compilationUnit]
, [enumConst]
, [deprMethodDecHead]
, [methodDecHead]
, [singleElemAnno]
, [anno]
, [markerAnno]
, [fieldDec]
, [constrBody]
, [packageName]
, [qSuperField]
, [field]
, [superField]
, [qSuperConstrInv]
, [superConstrInv]
, [altConstrInv]
, [octa]
, [hexa]
, [deci]
, [elemValPair]
, [catch]
, [arrayInit]
2, [arrayVarDecId]
, [elemValArrayInit]
2, [constrDec]
, [interfaceType]
, [packageDec]
, [arrayAccess]
, [typeImportOnDemandDec]
, [typeImportDec]
, [staticImportDec]
, [staticImportOnDemandDec]
, [unboundWld]
, [typeName]
2, [case]
, [default]
, [constrDecHead]
, [synchronized]
, [exprStm]
, [for]
2, [continue]
, [try]
2, [throw]
, [switch]
, [if]
2, [break]
, [empty]
, [labeled]
, [assertStm]
2, [forEach]
, [return]
, [doWhile]
, [while]
, [null]
, [void]
, [postDecr]
, [postIncr]
, [castPrim]
, [castRef]
, [minus]
2, [preIncr]
, [plus]
2, [preDecr]
, [this]
, [mul]
, [div]
, [remain]
, [qThis]
, [complement]
, [not]
, [uRightShift]
, [rightShift]
, [leftShift]
, [ltEq]
, [lt]
, [gtEq]
, [instanceOf]
, [gt]
, [eq]
, [notEq]
, [and]
, [excOr]
, [or]
, [lazyAnd]
, [lazyOr]
, [cond]
, [assignMinus]
, [assignExcOr]
, [assignPlus]
, [assignURightShift]
, [assignAnd]
, [assignDiv]
, [assignMul]
, [assignRemain]
, [assignLeftShift]
, [assignRightShift]
, [assignOr]
, [assign]
, [qNewInstance]
, [lit]
, [newInstance]
, [exprName]
3, [invoke]
, [arrayType]
, [classBody]
, [member]
, [boolean]
, [enumDec]
, [wildcard]
, [methodName]
2, [voidClass]
, [class]
, [abstractMethodDec]
, [deprAbstractMethodDec]
, [id]
, [typeBound]
, [annoMethodDec]
, [false]
, [true]
, [noMethodBody]
, [defaultVal]
, [methodDec]
, [ambName]
2, [newArray]
2, [typeArgs]
, [annoDecHead]
, [typeParam]
, [method]
2, [superMethod]
, [genericMethod]
, [qSuperMethod]
, [superDec]
, [instanceInit]
, [enumBody]
2, [throwsDec]
, [block]
, [typeVar]
, [dim]
2, [classDecStm]
, [implementsDec]
, [varDec]
2, [classOrInterfaceType]
.LocalVarDec ::= [localVarDec]::","Type VarDec
TypeParams ::= [typeParams]::"<" TypeParam "," ">"
Literal ::= CharLiteral
Literal ::= BoolLiteral
Literal ::= ClassLiteral
Literal ::= FloatLiteral
Literal ::= StringLiteral
Literal ::= NullLiteral
Literal ::= IntLiteral
ClassMod ::=
"abstract"
ClassMod ::=
"static"
ClassMod ::=
"public"
ClassMod ::=
"strictfp"
ClassMod ::=
"final"
ClassMod ::=
"private"
ClassMod ::=
"protected"
ClassDecHead ::= [classDecHead]::"class" Id TypeParams Super Interfaces
ClassDec ::= EnumDec
ClassDec ::= [classDec]::ClassDecHead ClassBody
SwitchGroup ::= [switchGroup]::SwitchLabel BlockStm
ClassBodyDec ::= ClassMemberDec
ClassBodyDec ::= StaticInit
ClassBodyDec ::= ConstrDec
ClassBodyDec ::= InstanceInit
FloatType ::=
[double]::"double"
FloatType ::=
[float]::"float"
ClassMemberDec ::= ClassDec
ClassMemberDec ::= MethodDec
ClassMemberDec ::= FieldDec
ClassMemberDec ::=
[semicolon]::";"
ClassMemberDec ::= InterfaceDec
ConstantMod ::=
"static"
ConstantMod ::=
"public"
ConstantMod ::=
"final"
ConstantDec ::= [constantDec]::"," ";"Type VarDec
SwitchBlock ::= [switchBlock]::"{" SwitchGroup SwitchLabel "}"
CondMid ::= "?" Expr ":"
WildcardBound ::= [wildcardUpperBound]::"extends" RefType
WildcardBound ::= [wildcardLowerBound]::"super" RefType
EnumDecHead ::= [enumDecHead]::"enum" Id Interfaces
PackageOrTypeName ::= [packageOrTypeName]::Id
PackageOrTypeName ::= [packageOrTypeName]::"." IdPackageOrTypeName
InterfaceDecHead ::= [interfaceDecHead]::"interface" Id TypeParams ExtendsInterfaces
IntType ::=
[int]::"int"
IntType ::=
[byte]::"byte"
IntType ::=
[long]::"long"
IntType ::=
[short]::"short"
IntType ::=
[char]::"char"
VarInit ::= Expr
VarInit ::= ArrayInit
EnumBodyDecs ::= [enumBodyDecs]::";" ClassBodyDec
ClassType ::= [classType]::TypeDecSpec TypeArgs
ExtendsInterfaces ::= [extendsInterfaces]::"extends" InterfaceType ","
StaticInit ::= [staticInit]::"static" Block
FormalParam ::= [varArityParam]::"..." VarDecIdType
FormalParam ::= [param]::Type VarDecId
EnumConstArgs ::= "(" Expr "," ")"
LocalVarDecStm ::= [localVarDecStm]::";"LocalVarDec
CompilationUnit ::= [compilationUnit]::PackageDec ImportDec TypeDec
EnumConst ::= [enumConst]::Id EnumConstArgs ClassBody
NumType ::= FloatType
NumType ::= IntType
MethodDecHead ::= [deprMethodDecHead]::"(" FormalParam "," ")" Dim ThrowsTypeParams ResultType Id
MethodDecHead ::= [methodDecHead]::"(" FormalParam "," ")" ThrowsTypeParams ResultType Id
Anno ::= [singleElemAnno]::"@" TypeName "(" ")"
Anno ::= [anno]::"@" TypeName "(" ElemValPair "," ")"
Anno ::= [markerAnno]::"@" TypeName
FieldDec ::= [fieldDec]::"," ";"Type VarDec
FieldMod ::=
"public"
FieldMod ::=
"static"
FieldMod ::=
"transient"
FieldMod ::=
"final"
FieldMod ::=
"volatile"
FieldMod ::=
"private"
FieldMod ::=
"protected"
ArraySubscript ::= "[" Expr "]"
FloatLiteral ::= [float]::ε
ConstrBody ::= [constrBody]::"{" ConstrInv BlockStm "}"
PackageName ::= [packageName]::"."Id
FieldAccess ::= [qSuperField]::"." "super" "." IdTypeName
FieldAccess ::= [field]::"." Id
FieldAccess ::= [superField]::"super" "." Id
ConstrInv ::= [qSuperConstrInv]::"." TypeArgs "super" "(" Expr "," ")" ";"Expr
ConstrInv ::= [superConstrInv]::"super" "(" Expr "," ")" ";"TypeArgs
ConstrInv ::= [altConstrInv]::"this" "(" Expr "," ")" ";"TypeArgs
IntLiteral ::= [octa]::ε
IntLiteral ::= [hexa]::ε
IntLiteral ::= [deci]::ε
InterfaceMemberDec ::=
[semicolon]::";"
InterfaceMemberDec ::= InterfaceDec
InterfaceMemberDec ::= AbstractMethodDec
InterfaceMemberDec ::= ClassDec
InterfaceMemberDec ::= ConstantDec
ElemValPair ::= [elemValPair]::"="Id
CatchClause ::= [catch]::"catch" "(" FormalParam ")" Block
ArrayInit ::= [arrayInit]::"{" VarInit "," "," "}"
ArrayInit ::= [arrayInit]::"{" VarInit "," "}"
VarDecId ::= Id
VarDecId ::= [arrayVarDecId]::Id Dim
Modifier ::=
"protected"
Modifier ::=
"private"
Modifier ::=
"volatile"
Modifier ::=
"synchronized"
Modifier ::=
"final"
Modifier ::=
"strictfp"
Modifier ::=
"transient"
Modifier ::=
"abstract"
Modifier ::=
"native"
Modifier ::=
"static"
Modifier ::=
"public"
ElemVal ::= [elemValArrayInit]::"{" ElemVal "," "}"
ElemVal ::= Expr
ElemVal ::= Anno
ElemVal ::= [elemValArrayInit]::"{" ElemVal "," "," "}"
ConstrDec ::= [constrDec]::ConstrHead ConstrBody
ConstrMod ::=
"protected"
ConstrMod ::=
"private"
ConstrMod ::=
"public"
InterfaceType ::= [interfaceType]::TypeDecSpec TypeArgs
PackageDec ::= [packageDec]::"package" PackageName ";"Anno
ArrayAccess ::= [arrayAccess]::ArraySubscript
ImportDec ::= [typeImportOnDemandDec]::"import" PackageName "." "*" ";"
ImportDec ::= [typeImportDec]::"import" TypeName ";"
ImportDec ::= [staticImportDec]::"import" "static" TypeName "." Id ";"
ImportDec ::= [staticImportOnDemandDec]::"import" "static" TypeName "." "*" ";"
ArrayBaseType ::= TypeName
ArrayBaseType ::= PrimType
ArrayBaseType ::= [unboundWld]::"<" "?" ">"TypeName
TypeName ::= [typeName]::"." IdPackageOrTypeName
TypeName ::= [typeName]::Id
SwitchLabel ::= [case]::"case" Expr ":"
SwitchLabel ::= [default]::"default" ":"
ConstrHead ::= [constrDecHead]::"(" FormalParam "," ")" ThrowsTypeParams Id
Stm ::= [synchronized]::"synchronized" "(" Expr ")" Block
Stm ::= [exprStm]::";"Expr
Stm ::= [for]::"for" "(" Expr "," ";" Expr ";" Expr "," ")" Stm
Stm ::= [for]::"for" "(" LocalVarDec ";" Expr ";" Expr "," ")" Stm
Stm ::= Block
Stm ::= [continue]::"continue" Id ";"
Stm ::= [try]::"try" Block CatchClause
Stm ::= [throw]::"throw" Expr ";"
Stm ::= [switch]::"switch" "(" Expr ")" SwitchBlock
Stm ::= [if]::"if" "(" Expr ")" Stm
Stm ::= [break]::"break" Id ";"
Stm ::=
[empty]::";"
Stm ::= [labeled]::":" StmId
Stm ::= [assertStm]::"assert" Expr ":" Expr ";"
Stm ::= [forEach]::"for" "(" FormalParam ":" Expr ")" Stm
Stm ::= [assertStm]::"assert" Expr ";"
Stm ::= [try]::"try" Block CatchClause "finally" Block
Stm ::= [return]::"return" Expr ";"
Stm ::= [doWhile]::"do" Stm "while" "(" Expr ")" ";"
Stm ::= [while]::"while" "(" Expr ")" Stm
Stm ::= [if]::"if" "(" Expr ")" Stm "else" Stm
NullLiteral ::=
[null]::"null"
ExceptionType ::= ClassType
ResultType ::= Type
ResultType ::=
[void]::"void"
Expr ::= [postDecr]::"--"Expr
Expr ::= [postIncr]::"++"Expr
Expr ::= [castPrim]::"(" PrimType ")" Expr
Expr ::= [castRef]::"(" RefType ")" Expr
Expr ::= [minus]::Expr
Expr ::= [preIncr]::"++" Expr
Expr ::= [plus]::Expr
Expr ::= [preDecr]::"--" Expr
Expr ::=
[this]::"this"
Expr ::= [mul]::"*" ExprExpr
Expr ::= [div]::Expr Expr
Expr ::= [remain]::"%" ExprExpr
Expr ::= [qThis]::"." "this"TypeName
Expr ::= [complement]::"~" Expr
Expr ::= [not]::"!" Expr
Expr ::= [plus]::Expr Expr
Expr ::= [minus]::Expr Expr
Expr ::= [uRightShift]::">>>" ExprExpr
Expr ::= [rightShift]::">>" ExprExpr
Expr ::= [leftShift]::"<<" ExprExpr
Expr ::= [ltEq]::"<=" ExprExpr
Expr ::= [lt]::"<" ExprExpr
Expr ::= [gtEq]::">=" ExprExpr
Expr ::= [instanceOf]::"instanceof" RefTypeExpr
Expr ::= [gt]::">" ExprExpr
Expr ::= [eq]::"==" ExprExpr
Expr ::= [notEq]::"!=" ExprExpr
Expr ::= [and]::"&" ExprExpr
Expr ::= [excOr]::"^" ExprExpr
Expr ::= [or]::"|" ExprExpr
Expr ::= [lazyAnd]::"&&" ExprExpr
Expr ::= [lazyOr]::"||" ExprExpr
Expr ::= [cond]::Expr CondMid Expr
Expr ::= [assignMinus]::"-=" ExprLHS
Expr ::= [assignExcOr]::"^=" ExprLHS
Expr ::= [assignPlus]::"+=" ExprLHS
Expr ::= [assignURightShift]::">>>=" ExprLHS
Expr ::= [assignAnd]::"&=" ExprLHS
Expr ::= [assignDiv]::"/=" ExprLHS
Expr ::= [assignMul]::"*=" ExprLHS
Expr ::= [assignRemain]::"%=" ExprLHS
Expr ::= [assignLeftShift]::"<<=" ExprLHS
Expr ::= [assignRightShift]::">>=" ExprLHS
Expr ::= [assignOr]::"|=" ExprLHS
Expr ::= [assign]::"=" ExprLHS
Expr ::= [qNewInstance]::"." "new" TypeArgs Id TypeArgs "(" Expr "," ")" ClassBodyExpr
Expr ::= [lit]::Literal
Expr ::= [newInstance]::"new" TypeArgs ClassOrInterfaceType "(" Expr "," ")" ClassBody
Expr ::= [exprName]::ExprName
Expr ::= ArrayCreationExpr
Expr ::= "(" Expr ")"
Expr ::= ε
Expr ::= [invoke]::"(" Expr "," ")"MethodSpec
ArrayType ::= [arrayType]::"[" "]"Type
ClassBody ::= [classBody]::"{" ClassBodyDec "}"
TypeDecSpec ::= TypeName
TypeDecSpec ::= [member]::"." IdTypeDecSpec TypeArgs
PrimType ::= NumType
PrimType ::=
[boolean]::"boolean"
EnumDec ::= [enumDec]::EnumDecHead EnumBody
ActualTypeArg ::= Type
ActualTypeArg ::= [wildcard]::"?" WildcardBound
MethodName ::= [methodName]::"." IdAmbName
MethodName ::= [methodName]::Id
InterfaceDec ::= InterfaceDecHead "{" InterfaceMemberDec "}"
InterfaceDec ::= AnnoDecHead "{" AnnoElemDec "}"
InterfaceMod ::=
"public"
InterfaceMod ::=
"static"
InterfaceMod ::=
"abstract"
InterfaceMod ::=
"strictfp"
InterfaceMod ::=
"protected"
InterfaceMod ::=
"private"
ClassLiteral ::= [voidClass]::"void" "." "class"
ClassLiteral ::= [class]::"." "class"Type
StringLiteral ::= ε
AbstractMethodMod ::=
"abstract"
AbstractMethodMod ::=
"public"
AbstractMethodDec ::= [abstractMethodDec]::"(" FormalParam "," ")" Throws ";"TypeParams ResultType Id
AbstractMethodDec ::= [deprAbstractMethodDec]::"(" FormalParam "," ")" Dim Throws ";"TypeParams ResultType Id
Id ::= [id]::ε
TypeBound ::= [typeBound]::"extends" ClassOrInterfaceType "&"
AnnoElemDec ::= EnumDec
AnnoElemDec ::=
[semicolon]::";"
AnnoElemDec ::= ClassDec
AnnoElemDec ::= ConstantDec
AnnoElemDec ::= InterfaceDec
AnnoElemDec ::= [annoMethodDec]::"(" ")" DefaultVal ";"AbstractMethodMod Type Id
BoolLiteral ::=
[false]::"false"
BoolLiteral ::=
[true]::"true"
MethodBody ::=
[noMethodBody]::";"
MethodBody ::= Block
ExprName ::= [exprName]::Id
ExprName ::= [exprName]::"." IdAmbName
DefaultVal ::=
[defaultVal]::"default"
MethodDec ::= [methodDec]::MethodDecHead MethodBody
AmbName ::= [ambName]::"." IdAmbName
AmbName ::= [ambName]::Id
MethodMod ::=
"final"
MethodMod ::=
"strictfp"
MethodMod ::=
"synchronized"
MethodMod ::=
"protected"
MethodMod ::=
"private"
MethodMod ::=
"static"
MethodMod ::=
"public"
MethodMod ::=
"abstract"
MethodMod ::=
"native"
ArrayCreationExpr ::= [newArray]::"new" ArrayBaseType DimExpr
ArrayCreationExpr ::= [newArray]::"new" ArrayBaseType ArrayInit
RefType ::= ClassOrInterfaceType
RefType ::= ArrayType
TypeDec ::= InterfaceDec
TypeDec ::= ClassDec
TypeDec ::=
[semicolon]::";"
TypeArgs ::= [typeArgs]::"<" ActualTypeArg "," ">"
LHS ::= ExprName
LHS ::= ε
AnnoDecHead ::= [annoDecHead]::"@" "interface" Id
TypeParam ::= [typeParam]::TypeVarId TypeBound
MethodSpec ::= [method]::MethodName
MethodSpec ::= [superMethod]::"super" "." TypeArgs Id
MethodSpec ::= [genericMethod]::"." TypeArgs IdAmbName
MethodSpec ::= [qSuperMethod]::"." "super" "." TypeArgs IdTypeName
MethodSpec ::= [method]::"." TypeArgs Id
Type ::= RefType
Type ::= PrimType
Super ::= [superDec]::"extends" ClassType
CharLiteral ::= ε
InstanceInit ::= [instanceInit]::Block
EnumBody ::= [enumBody]::"{" EnumConst "," EnumBodyDecs "}"
EnumBody ::= [enumBody]::"{" EnumConst "," "," EnumBodyDecs "}"
Throws ::= [throwsDec]::"throws" ExceptionType ","
Block ::= [block]::"{" BlockStm "}"
TypeVar ::= [typeVar]::TypeVarId
TypeVarId ::= Id
Dim ::= [dim]::"[" "]"
BlockStm ::= Stm
BlockStm ::= [classDecStm]::ClassDec
BlockStm ::= LocalVarDecStm
DimExpr ::= [dim]::"[" Expr "]"
Interfaces ::= [implementsDec]::"implements" InterfaceType ","
VarMod ::=
"final"
VarDec ::= [varDec]::"=" VarInitVarDecId
VarDec ::= [varDec]::VarDecId
ClassOrInterfaceType ::= [classOrInterfaceType]::TypeDecSpec TypeArgs