BNF for statements.oo

NON-TERMINALS

CompilationUnit ::= Block <EOF>
Type ::= ( "boolean" | "int" | "float" )
Expression ::= ConditionalOrExpression
ConditionalOrExpression ::= ConditionalAndExpression ( "||" ConditionalAndExpression )*
ConditionalAndExpression ::= InclusiveOrExpression ( "&&" InclusiveOrExpression )*
InclusiveOrExpression ::= ExclusiveOrExpression ( "|" ExclusiveOrExpression )*
ExclusiveOrExpression ::= AndExpression ( "^" AndExpression )*
AndExpression ::= EqualityExpression ( "&" EqualityExpression )*
EqualityExpression ::= RelationalExpression ( ( ( "==" | "!=" ) ) RelationalExpression )*
RelationalExpression ::= ShiftExpression ( ( ( "<" | ">" | "<=" | ">=" ) ) ShiftExpression )?
ShiftExpression ::= AdditiveExpression ( ( ( "<<" | ">>" | ">>>" ) ) AdditiveExpression )*
AdditiveExpression ::= MultiplicativeExpression ( ( ( "+" | "-" ) ) MultiplicativeExpression )*
MultiplicativeExpression ::= UnaryExpression ( ( ( "*" | "/" | "%" ) ) UnaryExpression )*
UnaryExpression ::= ( ( ( "+" | "-" ) ) UnaryExpression | UnaryExpressionNotPlusMinus )
UnaryExpressionNotPlusMinus ::= ( ( ( "~" | "!" ) ) UnaryExpression | PrimaryExpression )
PrimaryExpression ::= ( Literal | "(" Expression ")" | <IDENTIFIER> )
Literal ::= ( <INTEGER_LITERAL> | <FLOATING_POINT_LITERAL> | BooleanLiteral )
BooleanLiteral ::= ( "true" | "false" )
Statement ::= ( Block | EmptyStatement | StatementExpression ";" | SwitchStatement | IfStatement | WhileStatement | BreakStatement | ContinueStatement | PrintStatement )
PrintStatement ::= "print" "(" Expression ")" ";"
Block ::= "{" ( BlockStatement )* "}"
BlockStatement ::= ( LocalVariableDeclaration ";" | Statement )
LocalVariableDeclaration ::= Type <IDENTIFIER> "=" Expression
EmptyStatement ::= ";"
StatementExpression ::= <IDENTIFIER> "=" Expression
SwitchStatement ::= "switch" "(" Expression ")" "{" ( SwitchClause )* "}"
SwitchClause ::= SwitchLabel ( BlockStatement )*
SwitchLabel ::= ( CaseLabel | "default" ":" )
CaseLabel ::= "case" Expression ":"
IfStatement ::= "if" "(" Expression ")" Statement "else" Statement
WhileStatement ::= "while" "(" Expression ")" Statement
BreakStatement ::= "break" ";"
ContinueStatement ::= "continue" ";"