search
Log In
1 vote
236 views
As in Ada, suppose that each expression must have a unique type, but that from a subexpression, by itself, all we can deduce is a set of  possible types. That is, the application of function $E_{1}$ to argument $E_{2}$ , represented by $E\rightarrow E_{l}(E_{2})$, has the associated rule

$E.type=\{t\mid \text{for some $s$ in} \:E_{2}.type,s\rightarrow t\: \text{is in}\: E_{1}.type\}$

Describe an SDD that determines a unique type for each subexpression by using an attribute $type$ to synthesize a set of possible types bottom-up, and, once the unique type of the overall expression is determined, proceeds top-down to determine attribute $unique$ for the type of each subexpression.
in Compiler Design 236 views

Please log in or register to answer this question.

Related questions

0 votes
0 answers
1
114 views
Assuming that function $widen$ in Fig. $6.26$ can handle any of the types in the hierarchy of Fig. $6.25(a)$, translate the expressions below. Assume that c and d are characters, $s$ and $t$ are short integers, $i$ and $j$ are integers, and $x$ is a float. $x=s+c$ $i=s+c$ $x=(s+c)\ast(t+d)$
asked Sep 7, 2019 in Compiler Design Lakshman Patel RJIT 114 views
0 votes
0 answers
2
57 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.
asked Sep 7, 2019 in Compiler Design Lakshman Patel RJIT 57 views
0 votes
0 answers
3
117 views
$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.
asked Sep 7, 2019 in Compiler Design Lakshman Patel RJIT 117 views
0 votes
1 answer
4
115 views
$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]$
asked Sep 7, 2019 in Compiler Design Lakshman Patel RJIT 115 views
...