BNF for piglet.jj

NON-TERMINALS

Goal ::= "MAIN" StmtList "END" ( Procedure )* <EOF>
StmtList ::= ( ( Label )? Stmt )*
Procedure ::= Label "[" IntegerLiteral "]" StmtExp
Stmt ::= NoOpStmt
| ErrorStmt
| CJumpStmt
| JumpStmt
| HStoreStmt
| HLoadStmt
| MoveStmt
| PrintStmt
NoOpStmt ::= "NOOP"
ErrorStmt ::= "ERROR"
CJumpStmt ::= "CJUMP" Exp Label
JumpStmt ::= "JUMP" Label
HStoreStmt ::= "HSTORE" Exp IntegerLiteral Exp
HLoadStmt ::= "HLOAD" Temp Exp IntegerLiteral
MoveStmt ::= "MOVE" Temp Exp
PrintStmt ::= "PRINT" Exp
Exp ::= StmtExp
| Call
| HAllocate
| BinOp
| Temp
| IntegerLiteral
| Label
StmtExp ::= "BEGIN" StmtList "RETURN" Exp "END"
Call ::= "CALL" Exp "(" ( Exp )* ")"
HAllocate ::= "HALLOCATE" Exp
BinOp ::= Operator Exp Exp
Operator ::= "LT"
| "PLUS"
| "MINUS"
| "TIMES"
Temp ::= "TEMP" IntegerLiteral
IntegerLiteral ::= <INTEGER_LITERAL>
Label ::= <IDENTIFIER>