Question: 1. Code generation for expressions. Generate C-Machine (CMA) code for the following expressions: a 2 (c + (b 3)) b b (a + 3) Assume

1. Code generation for expressions. Generate C-Machine (CMA) code for the following expressions: a 2 (c + (b 3)) b b (a + 3) Assume the following address environment: = {a 5, b 6, c 7}

Execute the generated code by displaying the stack contents after each instruction! Assume that the variables are initialized with the values a = 22, b = 33 and c = 44.

Code generation for loops.

2.Generate CMA code for the two loops: while (x > y) { if (2 y > x) y y + x; else x x y; } for (x 0; x < 42; x x + z) if ((x = y))z z + 1; Use the following address environment: = {x 2, y 3, z 5}

Code generation for statement sequences.

3.Consider the following sequence of statements: z 1; while (n > 0) { j 1; y x; while (2 j n) { y y y; j j 2; } z y z; n n j; } What does this statement sequence compute? Translate the statement sequence into CMA code! Use the following address environment: = {n 1, j 2, x 3, y 4, z 5}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!