Starting from:

$24.99

Compilers lab 1

Assignment #1
Extend the hand-written compiler discussed in the tutorial so that it can translate code segments generated by the following grammar:
stmt → id := expr
| if expr then stmt
| while expr do stmt
| begin opt_stmts end
opt_stmts → stmt_list |є
stmt_list → stmt_list; stmt | stmt
Also, modify the grammar for handling expressions so that it can handle relational operators (=, <, ) as well as arithmetic operators (+, -, *, /). Try to generate x85 / x86 assembly as the translated code.
Before doing the above assignment, draw an expression tree for the expression:
a + b * c + 4

More products