set → set + term | term
term → term ∪ group | term ∩ group | group
group → ( set ) | { } | { list }
list → list # COUNTRY | COUNTRY
Note: the solution is not unique.
| 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 = { ID.value } ∪ 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 = { ID.value } |
| exp → BOOLLITERAL | exp.trans = { } |
| exp → INTLITERAL | exp.trans = { } |