BNF for expressions.oo
NON-TERMINALS
CompilationUnit
::=
Expression
<EOF>
PrimitiveType
::=
( "boolean" | "int" | "float" )
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"
PrimitiveType
)?
RelationalExpression
::=
ShiftExpression
( ( ( "<" | ">" | "<=" | ">=" ) )
ShiftExpression
)?
ShiftExpression
::=
AdditiveExpression
( ( ( "<<" | ">>" | ">>>" ) )
AdditiveExpression
)*
AdditiveExpression
::=
MultiplicativeExpression
( ( ( "+" | "-" ) )
MultiplicativeExpression
)*
MultiplicativeExpression
::=
UnaryExpression
( ( ( "*" | "/" | "%" ) )
UnaryExpression
)*
UnaryExpression
::=
( ( ( "+" | "-" ) )
UnaryExpression
|
UnaryExpressionNotPlusMinus
)
UnaryExpressionNotPlusMinus
::=
( ( ( "~" | "!" ) )
UnaryExpression
|
PrimaryExpression
)
PrimaryExpression
::=
(
Literal
| "("
Expression
")" )
Literal
::=
( <INTEGER_LITERAL> | <FLOATING_POINT_LITERAL> |
BooleanLiteral
)
BooleanLiteral
::=
( "true" | "false" )