BNF for Lang.jj

NON-TERMINALS

CompilationUnit ::= <WITH> <ADALOGO> <SEMI> <USE> <ADALOGO> <SEMI> ProcedureDeclaration Semi <EOF>
Semi ::= <SEMI>
Declaration ::= ( ( VariableDeclaration | ProcedureDeclaration ) Semi )*
ProcedureDeclaration ::= <PROCEDURE> ProcedureDeclarationIdentifier ( ProcedureDeclarationParameters )? <IS> Declaration <BEGIN> SequenceOfStatement <END>
ProcedureDeclarationIdentifier ::= <IDENTIFIER>
ProcedureDeclarationParameters ::= <LPAREN> ( VariableDeclaration ) ( Semi ( VariableDeclaration ) )* <RPAREN>
VariableDeclaration ::= VariableDeclarationIdentifier <COLON> ( <BOOLEAN> | <INTEGER> ) ( <IS_ASSIGNED> BooleanExpression )?
VariableDeclarationIdentifier ::= <IDENTIFIER>
SequenceOfStatement ::= ( ( ForwardStatement | JumpToStatement | NewLineStatement | PenDownStatement | PenUpStatement | PutLineStatement | PutStatement | ResetTurtleStatement | TurnStatement | TurnToStatement | AssignmentStatement | ExitStatement | ForStatement | IfStatement | LoopStatement | NullStatement | ProcedureCallStatement | WhileStatement ) Semi )+
ForwardStatement ::= <FORWARD> <LPAREN> IntegerExpression <RPAREN>
JumpToStatement ::= <JUMPTO> <LPAREN> IntegerExpression <COMMA> IntegerExpression <RPAREN>
NewLineStatement ::= <NEW_LINE>
PenDownStatement ::= <PENDOWN>
PenUpStatement ::= <PENUP>
PutLineStatement ::= <PUT_LINE> <LPAREN> ( BooleanExpression | StringLiteral ) <RPAREN>
PutStatement ::= <PUT> <LPAREN> ( BooleanExpression | StringLiteral ) <RPAREN>
StringLiteral ::= <STRING_LITERAL>
ResetTurtleStatement ::= <RESETTURTLE>
TurnStatement ::= <TURN> <LPAREN> IntegerExpression <RPAREN>
TurnToStatement ::= <TURNTO> <LPAREN> IntegerExpression <RPAREN>
AssignmentStatement ::= AssignmentIdentifier <IS_ASSIGNED> BooleanExpression
AssignmentIdentifier ::= <IDENTIFIER>
ExitStatement ::= <EXIT>
ForStatement ::= <FOR> ForIdentifier <IN> ( ForReverse )? IntegerExpression <DOT_DOT> IntegerExpression <LOOP> SequenceOfStatement <END> <LOOP>
ForIdentifier ::= <IDENTIFIER>
ForReverse ::= <REVERSE>
IfStatement ::= <IF> BooleanExpression <THEN> SequenceOfStatement ( ElsifPart )* ( ElsePart )? <END> <IF>
ElsifPart ::= <ELSIF> BooleanExpression <THEN> SequenceOfStatement
ElsePart ::= <ELSE> SequenceOfStatement
NullStatement ::= <NULL>
LoopStatement ::= <LOOP> SequenceOfStatement <END> <LOOP>
ProcedureCallStatement ::= ProcedureCallStatementIdentifier ( ProcedureCallStatementParameters )?
ProcedureCallStatementIdentifier ::= <IDENTIFIER>
ProcedureCallStatementParameters ::= <LPAREN> ( BooleanExpression ) ( <COMMA> ( BooleanExpression ) )* <RPAREN>
WhileStatement ::= <WHILE> BooleanExpression <LOOP> SequenceOfStatement <END> <LOOP>
Identifier ::= <IDENTIFIER>
BooleanExpression ::= OrExpression
OrExpression ::= AndExpression ( <OR> AndExpression )*
AndExpression ::= UnaryBooleanExpression ( <AND> UnaryBooleanExpression )*
UnaryBooleanExpression ::= <NOT> ( EqualityExpression | BooleanLiteral | <LPAREN> BooleanExpression <RPAREN> )
| EqualityExpression
| BooleanLiteral
| <LPAREN> BooleanExpression <RPAREN>
EqualityExpression ::= RelationalExpression ( <EQ> RelationalExpression | <NE> RelationalExpression )?
RelationalExpression ::= IntegerExpression ( <GT> IntegerExpression | <GT_EQ> IntegerExpression | <LT> IntegerExpression | <LT_EQ> IntegerExpression )?
BooleanLiteral ::= <TRUE>
| <FALSE>
IntegerExpression ::= AdditiveExpression
AdditiveExpression ::= MultiplicativeExpression ( <PLUS> MultiplicativeExpression | <DASH> MultiplicativeExpression )*
MultiplicativeExpression ::= UnaryIntegerExpression ( <STAR> UnaryIntegerExpression | <SLASH> UnaryIntegerExpression | <MOD> UnaryIntegerExpression | <REM> UnaryIntegerExpression )*
UnaryIntegerExpression ::= <DASH> ( IntegerLiteral | <LPAREN> IntegerExpression <RPAREN> | MinExpression | MaxExpression | RandomExpression | GetXExpression | GetYExpression | Identifier )
| IntegerLiteral
| <LPAREN> IntegerExpression <RPAREN>
| MinExpression
| MaxExpression
| RandomExpression
| GetXExpression
| GetYExpression
| Identifier
IntegerLiteral ::= <INTEGER_LITERAL>
MinExpression ::= <MIN> <LPAREN> IntegerExpression <COMMA> IntegerExpression <RPAREN>
MaxExpression ::= <MAX> <LPAREN> IntegerExpression <COMMA> IntegerExpression <RPAREN>
GetXExpression ::= <GETX>
GetYExpression ::= <GETY>
RandomExpression ::= <RANDOM> <LPAREN> IntegerExpression <COMMA> IntegerExpression <RPAREN>