-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathc2.txt
35 lines (28 loc) · 796 Bytes
/
c2.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
**Code Generation test case 2: Computing expressions using integer and boolean data type**
**Single driver module with single level nesting **
<<<driver program>>>
start
declare x, y, z:integer;
declare a, b, c:integer;
declare u, v: boolean;
u:= true;
a:= 5;
b:= 9;
get_value(x);
get_value(y);
z:= x + y*b +(a-b)*y+ a*2 - b*x;
v:= z > 10 OR a<=b AND x<y AND u; **follows left to right associativity**
print(z);
print(u);
end
** On the console
Input: Enter an integer value
2
Input: Enter an integer value
3
Output: 9
Output: true
For values of x = 2 and y = 3 as run time input, print z as 9.
Then print u as true (use string true or false to print output of a variable of boolean type).
Similarly run the generated assembly code for other input values and verify.
**