$8.3$ 请把语句
if (x+y)*z=0 then
s:=(a+b)*c
else
s:=a*b*c
翻译为:
(2) 三地址代码。
解:
0 t1 = x + y
1 t2 = t1 * z
2 IF t2 == 0 GOTO 7
3 t3 = a + b
4 t4 = t3 * c
5 s = t4
6 GOTO 10
7 t5 = a * b
8 t6 = t5 * c
9 s = t6
10
8.4 有如下的 C 语言程序片断,请把其中的可执行语句翻译为:
(2) 三地址代码。
main(){
int i;
int a[10];
i=0;
while (i<10) 1{
a[i]=0;
i++;
}
}
0 i = 0
1 IF i < 10 GOTO 3
2 GOTO 9
3 t1 = a
4 t2 = 2 * i
5 t1[t2] = 0
6 t3 = i + 1
7 i = t3
8 GOTO 1
9 EXIT