BNF for sadl.jj
NON-TERMINALS
addToSymbolTable
::=
java code
lookupSymbolTable
::=
java code
getIndex
::=
java code
error_skipto
::=
java code
SteeringScript
::=
<STSCR> <IDENTIFIER>
SteeredObjects
Actions
<END>
SteeredObjects
::=
<STOBJ>
TypedObjects
( ";"
TypedObjects
)* ( ";" )?
TypedObjects
::=
Type
ObjectDeclarator
( ","
ObjectDeclarator
)*
Actions
::=
SteeringActionDef
( ";"
SteeringActionDef
)*
SteeringActionDef
::=
<STACT> <IDENTIFIER> "=" (
Statements
| "{"
Statements
"}" )
SteeringLocationDef
Statements
::=
SteeringStatementDef
( ";"
SteeringStatementDef
)* ( ";" )?
SteeringStatementDef
::=
(
ObjectName
"="
Expression
)
|
( <CALL>
Expression
)
SteeringLocationDef
::=
( <BEFORE> | <AFTER> ) ( <READ> | <WRITE> | <CALL> )
ObjectName
ObjectName
::=
(
ObjectFullName
| <IDENTIFIER> )
ObjectDeclarator
::=
( <IDENTIFIER> "<-" )?
ObjectFullName
ObjectFullName
::=
Name
":" (
SimpleMethodDeclarator
|
VariableDeclaratorId
) ( "." (
SimpleMethodDeclarator
|
VariableDeclaratorId
) )*
ObjectNameRef
::=
Name
":" (
SimpleMethod
|
VariableId
) ( "." (
SimpleMethod
|
VariableId
) )*
SimpleMethodDeclarator
::=
<IDENTIFIER>
FormalParameters
FormalParameters
::=
"(" (
Type
( ","
Type
)* )? ")"
VariableId
::=
<IDENTIFIER> ( "["
Expression
"]" )*
SimpleMethod
::=
<IDENTIFIER>
Arguments
MethodLookahead
::=
<IDENTIFIER> "("
ObjectLookahead
::=
<IDENTIFIER> ( "." | ":" )
VariableDeclaratorId
::=
<IDENTIFIER> ( "[" "]" )*
Type
::=
(
PrimitiveType
|
Name
) ( "[" "]" )*
PrimitiveType
::=
( "boolean" )
|
( "char" )
|
( "byte" )
|
( "short" )
|
( "int" )
|
( "long" )
|
( "float" )
|
( "double" )
ResultType
::=
( "void" )
|
(
Type
)
Name
::=
<IDENTIFIER> ( "." ( <IDENTIFIER> ) )*
NameList
::=
Name
( ","
Name
)*
Expression
::=
ConditionalExpression
ConditionalExpression
::=
ConditionalOrExpression
( "?"
Expression
":"
ConditionalExpression
)?
ConditionalOrExpression
::=
(
ConditionalAndExpression
( "||"
ConditionalAndExpression
)* )
ConditionalAndExpression
::=
(
InclusiveOrExpression
( "&&"
InclusiveOrExpression
)* )
InclusiveOrExpression
::=
(
ExclusiveOrExpression
( "|"
ExclusiveOrExpression
)* )
ExclusiveOrExpression
::=
(
AndExpression
( "^"
AndExpression
)* )
AndExpression
::=
(
EqualityExpression
( "&"
EqualityExpression
)* )
EqualityExpression
::=
InstanceOfExpression
( ( "==" | "!=" )
InstanceOfExpression
)*
InstanceOfExpression
::=
RelationalExpression
( "instanceof"
Type
)?
RelationalExpression
::=
ShiftExpression
( ( "<" | ">" | "<=" | ">=" )
ShiftExpression
)*
ShiftExpression
::=
AdditiveExpression
( ( "<<" | ">>" | ">>>" )
AdditiveExpression
)*
AdditiveExpression
::=
MultiplicativeExpression
( ( "+" | "-" )
MultiplicativeExpression
)*
MultiplicativeExpression
::=
UnaryExpression
( ( "*" | "/" | "%" )
UnaryExpression
)*
UnaryExpression
::=
( ( "+" | "-" )
UnaryExpression
|
PreIncrementExpression
|
PreDecrementExpression
|
UnaryExpressionNotPlusMinus
)
PreIncrementExpression
::=
"++"
PrimaryExpression
PreDecrementExpression
::=
"--"
PrimaryExpression
UnaryExpressionNotPlusMinus
::=
( ( "~" | "!" )
UnaryExpression
|
CastExpression
|
PostfixExpression
)
CastLookahead
::=
"("
PrimitiveType
|
"("
Name
"[" "]"
|
"("
Name
")" ( "~" | "!" | "(" | <IDENTIFIER> | "this" | "super" | "new" |
Literal
)
PostfixExpression
::=
PrimaryExpression
( "++" | "--" )?
CastExpression
::=
( "("
PrimitiveType
( "[" "]" )* ")"
UnaryExpression
| "("
Name
( "[" "]" )* ")"
UnaryExpressionNotPlusMinus
)
PrimaryExpression
::=
(
ObjectNameRef
|
Literal
|
PrimaryPrefix
(
PrimarySuffix
)* |
AllocationExpression
)
PrimaryPrefix
::=
( "("
Expression
")" )
PrimarySuffix
::=
( "["
Expression
"]" | "." <IDENTIFIER> |
Arguments
)
Literal
::=
<INTEGER_LITERAL>
|
<FLOATING_POINT_LITERAL>
|
<CHARACTER_LITERAL>
|
<STRING_LITERAL>
|
BooleanLiteral
|
NullLiteral
BooleanLiteral
::=
"true"
|
"false"
NullLiteral
::=
"null"
Arguments
::=
"(" (
ArgumentList
)? ")"
ArgumentList
::=
Expression
( ","
Expression
)*
AllocationExpression
::=
( "new"
PrimitiveType
ArrayDimensions
| "new"
Name
(
Arguments
|
ArrayDimensions
) )
ArrayDimensions
::=
( "["
Expression
"]" )+ ( "[" "]" )*