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" Temp Label |
JumpStmt | ::= | "JUMP" Label |
HStoreStmt | ::= | "HSTORE" Temp IntegerLiteral Temp |
HLoadStmt | ::= | "HLOAD" Temp Temp IntegerLiteral |
MoveStmt | ::= | "MOVE" Temp Exp |
PrintStmt | ::= | "PRINT" SimpleExp |
Exp | ::= | Call |
| | HAllocate | |
| | BinOp | |
| | SimpleExp | |
StmtExp | ::= | "BEGIN" StmtList "RETURN" SimpleExp "END" |
Call | ::= | "CALL" SimpleExp "(" ( Temp )* ")" |
HAllocate | ::= | "HALLOCATE" SimpleExp |
BinOp | ::= | Operator Temp SimpleExp |
Operator | ::= | "LT" |
| | "PLUS" | |
| | "MINUS" | |
| | "TIMES" | |
SimpleExp | ::= | Temp |
| | IntegerLiteral | |
| | Label | |
Temp | ::= | "TEMP" IntegerLiteral |
IntegerLiteral | ::= | <INTEGER_LITERAL> |
Label | ::= | <IDENTIFIER> |