Open sammyrocz opened 8 years ago
The solution of 6.4.1 part b) given in the repo is wrong
Your Answer E -> E1 * E2 { E.addr = new Temp(); E.code = E1.code || E2.code || gen(E.addr '=' E1.addr '*' E2.addr); }
| +E1 { E.addr = E1.addr; E.code = E1.code; }
But if you refer the book ( pg 381) The translation should be
E -> E1 * E2 { E.addr = new Temp(); E.code = E1.code || E2.code || gen(E.addr '=' E1.addr '*' E2.addr); }
| +E1 { E.addr = new Temp(); E.code = E1.code || gen(E.addr '=''plus'E1.addr) ; }
The same goes for 6.4.2 (the incremental one)
The solution of 6.4.1 part b) given in the repo is wrong
Your Answer E -> E1 * E2 { E.addr = new Temp(); E.code = E1.code || E2.code || gen(E.addr '=' E1.addr '*' E2.addr); }
| +E1 { E.addr = E1.addr; E.code = E1.code; }
But if you refer the book ( pg 381) The translation should be
E -> E1 * E2 { E.addr = new Temp(); E.code = E1.code || E2.code || gen(E.addr '=' E1.addr '*' E2.addr); }
| +E1 { E.addr = new Temp(); E.code = E1.code || gen(E.addr '=''plus'E1.addr) ; }
The same goes for 6.4.2 (the incremental one)