Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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. 2. 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} 3. 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Genomes And Databases On The Internet A Practical Guide To Functions And Applications

Authors: Paul Rangel

1st Edition

189848631X, 978-1898486312

More Books

Students also viewed these Databases questions

Question

=+j Explain the essential nature of repatriation.

Answered: 1 week ago