Generate the three-address code for the following? C program fragment: while (a > b) { if (c < d) x = y + z; else x = y - z; }
Added by Devashish S.
Step 1
The fragment consists of a `while` loop with an `if-else` statement inside it. The loop continues as long as the condition `(a > b)` is true. Inside the loop, if `(c < d)` is true, the statement `x = y + z` is executed; otherwise, `x = y - z` is executed. Show more…
Show all steps
Your feedback will help us improve your experience
Yujie Wang and 85 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Create DAG representation and three – address code for the following C program. i = 1; s = 0; while ( i<= 10) { s = s+ a[i] [i]; i = i + 1; }
Shu N.
Consider the three address code for the following program: While $(A<C$ and $B>D)$ do If $(A==1)$ then $C=C+1$; Else While $(A<=D)$ do $A=A+3$ How many temporaries are used? (A) 2 (B) 3 (C) 4 (D) 0
COMPILER DESIGN
INTERMEDIATE CODE GENERATION
Assume that the variables a and b are stored in memory locations 300 and 301. The values +1 and 0 are stored in them, respectively. Also, assume that the three integers are stored in memory locations 400, 401, and 402, respectively. Finally, assume that the code begins at memory location 50. Using any of the machine sequences shown in Section 5.24, translate the following algorithmic language into machine language equivalents. (20 points total, 2 points for each operation instruction and 1 point for each correct memory location) Set a to the value of a + b - 1 If a > 0, set b to the value +1
Sri K.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD