program → MAIN LPAREN RPAREN LCURLY list RCURLY |
program.trans = list.trans |
list → list oneItem |
list1.trans = list2.trans ∪ oneItem.trans |
list → epsilon |
list.trans = { } |
oneItem → decl |
oneItem.trans = { }
|
oneItem → stmt |
oneItem.trans = stmt.trans |
decl → BOOL ID SEMICOLON |
no translation rule needed |
decl → INT ID SEMICOLON |
no translation rule needed |
stmt → ID ASSIGN exp SEMICOLON |
stmt.trans = exp.trans |
stmt → IF LPAREN exp RPAREN stmt |
stmt1.trans = exp.trans ∪ stmt2.trans |
stmt → LCURLY list RCURLY |
stmt.trans = list.trans |
exp → exp PLUS exp |
exp1.trans = exp2.trans ∪ exp3.trans |
exp → exp LESS exp |
exp1.trans = exp2.trans ∪ exp3.trans |
exp → exp EQUALS exp |
exp1.trans = exp2.trans ∪ exp3.trans |
exp → ID |
exp.trans = { } |
exp → BOOLLITERAL |
exp.trans = { BOOLLITERAL.value } |
exp → INTLITERAL |
exp.trans = { INTLITERAL.value } |