Assessed Exercise 2, Task 1 |
Implement the part of the language in
black. No need to implement code generation for the red parts. No
test for this task will feature programs containing language
constructs in red. Your code generator can
throw PROG → DEC | DEC; PROG DEC → def ID (VARDEC) = E VARDEC → ε | VARDECNE VARDECNE → ID | VARDECNE, ID ID → ... (identifiers) INT → ... (Integers) E → INT | ID | if E COMP E then E else E endif | (E BINOP E) | (E) | ID(ARGS) | skip | (E; E) | while E COMP E do E endwhile | repeat E until E COMP E endrepeat | ID := E | break | continue ARGS → ε | ARGSNE ARGSNE → E | ARGSNE, E COMP → == | < | > | <= | >= BINOP → + | - | * | / Recall that the relevant definitions are
here, here
and here (and in the Zip file /
Github given on the parent page).
If you don't want to implement a feature, simply throw
Note that the translation of procedure invocation (given by the
production |