Ullman (Compiler Design) Edition 2 Exercise 6.4 Question 3 (Page No. 385)

63 views

Use the translation of Fig. $6.22$ to translate the following assignments:

1. $x=a[i]+b[j]$
2. $x=a[i][j]+b[i][j]$
3. $x=a[b[i][j]][c[[k]]$

Related questions

1
47 views
Generalize formula $(6.7)$ to multidimensional arrays, and indicate what values can be stored in the symbol table and used to compute offsets. Consider the following cases: An array $A$ of two dimensions, in row-major form. The first dimension has indexes running from $l_{1}$ ... has indexes running from $l_{j}$ to $h_{j}$.The same as $(c)$ but with the array stored in column-major form.
Revise the translation of Fig. $6.22$ for array references of the Fortran style, that is, $id[E_{1}, E_{2},\cdot\cdot\cdot,E_{n}]$ for an $n-$dimensional array.
$A$ real array $A[i, j, k]$ has index $i$ ranging from $1$ to $4$, index $j$ ranging from $0$ to $4$, and index $k$ ranging from $5$ to $10$. Reals take $8$ bytes each. Suppose array $A$ is stored starting at byte $0$. Find the location of: $A[3,4,5]$ $A[1,2,7]$ $A[4,3,9]$ if $A$ is stored in column-major order.
$A$ real array $A[i, j, k]$ has index $i$ ranging from $1$ to $4$, index $j$ ranging from $0$ to $4$, and index $k$ ranging from $5$ to $10$. Reals take $8$ bytes each. Suppose array $A$ is stored starting at byte $0$. Find the location of: $A[3,4,5]$ $A[1,2,7]$ $A[4,3,9]$