BNF for turtleTalk.jj

NON-TERMINALS

Translation_Unit ::= Block <EOF>
Block ::= Statement Block
| VarBlock
|
VarBlock ::= <VAR> Id <COLON> Id <ASSIGN> Expression Block
Statement ::= IfStatement
| WhileStatement
| PutStatement
| GetStatement
| AssignmentOrProcedureCallStatement
AssignmentOrProcedureCallStatement ::= Id ( <ASSIGN> Expression | Args )
IfStatement ::= <IF> Expression Block ( <ELSE> Block | ) <END>
WhileStatement ::= <WHILE> Expression Block <END>
PutStatement ::= <PUT> ( <STRING> | Expression )
GetStatement ::= <GET> Id
Expression ::= Disjunct ( <OR> Disjunct )*
Disjunct ::= Conjunct ( <AND> Conjunct )*
Conjunct ::= RelTerm ( <EQUAL> RelTerm | <LESS> RelTerm )?
RelTerm ::= Term ( <PLUS> Term | <MINUS> Term )*
Term ::= Factor ( <STAR> Factor | <SLASH> Factor )*
Factor ::= <OPEN_PAREN> Expression <CLOSE_PAREN>
| <MINUS> Factor
| <NOT> Factor
| <NUM>
| VarConstantOrFunctionCall
VarConstantOrFunctionCall ::= Id ( Args | )
Args ::= <OPEN_PAREN> ( Expression ( <COMMA> Expression )* )? <CLOSE_PAREN>
Id ::= <ID>