BNF for miniX10.jj
NON-TERMINALS
File
::=
(
TopLevelDeclaration
)* <EOF>
TopLevelDeclaration
::=
MainClass
|
ClassDeclaration
MainClass
::=
"public" "class"
Identifier
"{" "public" "static" "void" "main" "(" "String" "[" "]"
Identifier
")" "{"
Statement
"}" "}"
ClassDeclaration
::=
"class"
Identifier
"{" (
ClassMember
)* "}"
ClassMember
::=
MethodDeclaration
|
ConstantDeclaration
|
UpdatableFieldDeclaration
ConstantDeclaration
::=
"public" "static" "final"
Type
Identifier
"="
Expression
";"
UpdatableFieldDeclaration
::=
"public"
Type
Identifier
";"
MethodDeclaration
::=
"public"
ReturnType
Identifier
"(" (
FormalParameterList
)? ")"
Block
FormalParameterList
::=
FormalParameter
(
FormalParameterRest
)*
FormalParameter
::=
FinalFormalParameter
|
UpdatableFormalParameter
FinalFormalParameter
::=
"final"
Type
Identifier
UpdatableFormalParameter
::=
Type
Identifier
FormalParameterRest
::=
","
FormalParameter
ReturnType
::=
VoidType
|
Type
VoidType
::=
"void"
Type
::=
UpdatableArrayType
|
NonArrayType
UpdatableArrayType
::=
NonArrayType
"[" ":"
RankEquation
"]"
RankEquation
::=
"rank" "=="
IntegerLiteral
NonArrayType
::=
BooleanType
|
IntegerType
|
DoubleType
|
StringType
|
PlaceType
|
DistType
|
RegionType
|
PointType
|
ClassNameType
BooleanType
::=
"boolean"
IntegerType
::=
"int"
DoubleType
::=
"double"
StringType
::=
"String"
PlaceType
::=
"place"
DistType
::=
"dist" "(" ":"
RankEquation
")"
RegionType
::=
"region" "(" ":"
RankEquation
")"
PointType
::=
"point" "(" ":"
RankEquation
")"
ClassNameType
::=
Identifier
Identifier
::=
<IDENTIFIER>
Statement
::=
Assignment
|
AsyncStatement
|
Block
|
FinishStatement
|
IfStatement
|
LoopStatement
|
PostfixStatement
|
PrintlnStatement
|
ReturnStatement
|
ThrowStatement
|
WhileStatement
Assignment
::=
Expression
"="
Expression
";"
AsyncStatement
::=
"async" "("
Expression
")"
Block
Block
::=
"{" (
BlockStatement
)* "}"
BlockStatement
::=
FinalVariableDeclaration
|
UpdatableVariableDeclaration
|
Statement
FinalVariableDeclaration
::=
"final"
Type
Identifier
"="
Expression
";"
UpdatableVariableDeclaration
::=
Type
Identifier
"="
Expression
";"
FinishStatement
::=
"finish"
Statement
IfStatement
::=
"if" "("
Expression
")"
Statement
(
ElseClause
)?
ElseClause
::=
"else"
Statement
LoopStatement
::=
"for" "("
PointType
ExplodedSpecification
":"
Expression
")"
Statement
ExplodedSpecification
::=
IdentifierList
PointName
::=
Identifier
IdentifierList
::=
"["
Identifier
(
IdentifierRest
)* "]"
IdentifierRest
::=
","
Identifier
PostfixStatement
::=
Expression
";"
PrintlnStatement
::=
"System.out.println" "("
Expression
")" ";"
ReturnStatement
::=
"return" (
Expression
)? ";"
ThrowStatement
::=
"throw" "new" "RuntimeException" "("
Expression
")" ";"
WhileStatement
::=
"while" "("
Expression
")"
Statement
Expression
::=
InclusiveOrExpression
|
EqualsExpression
|
NotEqualsExpression
|
GreaterThanExpression
|
PlusExpression
|
MinusExpression
|
TimesExpression
|
DivideExpression
|
SinExpression
|
CosExpression
|
PowExpression
|
AbsExpression
|
MapExpression
|
RegionConstant
|
UnaryMinusExpression
|
CoercionToIntExpression
|
CoercionToDoubleExpression
|
TypeAnnotatedExpression
|
FactoryBlock
|
ArrayAccess
|
DotDistribution
|
DotIsFirst
|
DotMethodCall
|
DotIdentifier
|
PrimaryExpression
InclusiveOrExpression
::=
PrimaryExpression
"|"
Expression
EqualsExpression
::=
PrimaryExpression
"=="
Expression
NotEqualsExpression
::=
PrimaryExpression
"!="
Expression
GreaterThanExpression
::=
PrimaryExpression
">"
Expression
PlusExpression
::=
PrimaryExpression
"+"
Expression
MinusExpression
::=
PrimaryExpression
"-"
Expression
TimesExpression
::=
PrimaryExpression
"*"
Expression
DivideExpression
::=
PrimaryExpression
"/"
Expression
SinExpression
::=
"Math" "." "sin" "("
Expression
")"
CosExpression
::=
"Math" "." "cos" "("
Expression
")"
PowExpression
::=
"Math" "." "pow" "("
Expression
","
Expression
")"
AbsExpression
::=
"Math" "." "abs" "("
Expression
")"
MapExpression
::=
PrimaryExpression
"->"
PrimaryExpression
RegionConstant
::=
"["
ColonExpression
(
ColonRest
)? "]"
ColonRest
::=
","
ColonExpression
ColonExpression
::=
ColonPair
|
Expression
ColonPair
::=
Expression
":"
Expression
UnaryMinusExpression
::=
"-"
PrimaryExpression
CoercionToIntExpression
::=
"(" "int" ")"
Expression
CoercionToDoubleExpression
::=
"(" "double" ")"
Expression
TypeAnnotatedExpression
::=
"("
TypeAnnotation
")"
Expression
TypeAnnotation
::=
UpdatableArrayType
|
DistType
PrimaryExpression
::=
Literal
|
This
|
AllocationExpression
|
Identifier
This
::=
"this"
FactoryBlock
::=
"dist.factory.block" "("
Expression
")"
ArrayAccess
::=
PrimaryExpression
"["
ExpressionList
"]"
DotMethodCall
::=
PrimaryExpression
"."
Identifier
"(" (
ExpressionList
)? ")"
DotDistribution
::=
PrimaryExpression
"." "distribution"
DotIsFirst
::=
PrimaryExpression
"." "isFirst" "(" ")"
DotIdentifier
::=
PrimaryExpression
"."
Identifier
AllocationExpression
::=
NewObject
|
NewUpdatableArray
NewObject
::=
"new"
Identifier
"(" (
ExpressionList
)? ")"
NewUpdatableArray
::=
"new"
NonArrayType
"["
Identifier
"]" (
ArrayInitializer
)?
Literal
::=
IntegerLiteral
|
FloatingPointLiteral
|
StringLiteral
|
HereLiteral
|
DistUnique
IntegerLiteral
::=
<INTEGER_LITERAL>
FloatingPointLiteral
::=
<FLOATING_POINT_LITERAL>
StringLiteral
::=
<STRING_LITERAL>
HereLiteral
::=
"here"
DistUnique
::=
"dist.UNIQUE"
ExpressionList
::=
Expression
(
ArgumentRest
)*
ArgumentRest
::=
","
Expression
ArrayInitializer
::=
"("
PointType
ExplodedSpecification
")"
Block