Next: Exercise 10.
Up: Final-2003
Previous: Exercise 8.
The goal of this exercice is to translate into three-address code
a C-like piece of code for the multiplications of two square
matrices. To do so we assume that our three-address code implemnts
arrays like in C. A part from that, the three-address code
instructions you may need are of one of the usual forms:
- goto L where L is a symbolic label (like L1, L2, ...)
- if x relop y goto L where relop can be = or <
- x:= y op z where op can be - or + or *
Moreover your solution does not need to be obtained by one of the
algorithms of the course.
Just consider that you are programming a very basic calculator.
Here's the C-like piece of code we want to translate.
for (i=0; i<n; i++) {
for (j=0; j<n; j++) {
c[i,j] = 0;
for (k=0; k<n; k++) {
c[i,j] = c[i,j] + a[i,k] * b[k,j];
}
}
}
Answer 9
Next: Exercise 10.
Up: Final-2003
Previous: Exercise 8.
Marc Moreno Maza
2004-12-02