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.

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

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

Step: 3

blur-text-image

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

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago