search
Log In

Recent questions tagged ullman

1 vote
0 answers
1
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}$ ... and, once the unique type of the overall expression is determined, proceeds top-down to determine attribute $unique$ for the type of each subexpression.
asked Sep 7, 2019 in Compiler Design Lakshman Patel RJIT 212 views
0 votes
0 answers
2
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 104 views
0 votes
0 answers
3
$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 105 views
0 votes
1 answer
4
$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 106 views
0 votes
0 answers
5
An integer array $A[i, j]$ has index $i$ ranging from $1$ to $10$ and index $j$ ranging from $1$ to $20$. Integers take $4$ bytes each. Suppose array $A$ is stored starting at byte $0$. Find the location of: $A[4,5]$ $A[10,8]$ $A[3,17]$ if A is stored in column-major order.
asked Sep 7, 2019 in Compiler Design Lakshman Patel RJIT 368 views
0 votes
0 answers
6
An integer array $A[i, j]$ has index $i$ ranging from $1$ to $10$ and index $j$ ranging from $1$ to $20$. Integers take $4$ bytes each. Suppose array $A$ is stored starting at byte $0$. Find the location of: $A[4,5]$ $A[10,8]$ $A[3,17]$
asked Sep 7, 2019 in Compiler Design Lakshman Patel RJIT 102 views
0 votes
0 answers
7
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 47 views
0 votes
0 answers
12
Extend the handling of field names in Fig. $6.18$ to classes and single-inheritance class hierarchies. Give an implementation of class $Enu$ that allows linked symbol tables, so that a subclass can either redefine a field name or refer directly to a ... in a class, including inherited fields. Inherited fields must maintain the relative addresses they were assigned in the layout for the superclass.
asked Sep 7, 2019 in Compiler Design Lakshman Patel RJIT 42 views
0 votes
0 answers
13
1 vote
1 answer
15
0 votes
0 answers
17
0 votes
0 answers
19
Modify the SDD of Fig. $5.25$ to include superscripts denoted by operator sup between boxes. If box $B_{2}$ is a superscript of box $B_{1}$, then position the baseline of $B_{2}\:0.6$ times the point size of $B_{1}$ above the baseline of $B_{1}.\text{Add}$ the new production and rules to the SDT of Fig. $5.26$.
asked Sep 7, 2019 in Compiler Design Lakshman Patel RJIT 98 views
0 votes
0 answers
20
Modify the SDD of Fig. $5.25$ to include a synthesized attribute $B.le$, the length of a box. The length of the concatenation of two boxes is the sum of the lengths of each. Then add your new rules to the proper positions in the SDT of Fig. $5.26$.
asked Sep 7, 2019 in Compiler Design Lakshman Patel RJIT 82 views
0 votes
0 answers
21
Write L-attributed SDT's analogous to that of Example $5.19$ for the following productions, each of which represents a familiar flow-of-control construct, as in the programming language C. You may need to generate a three address statement to jump to a particular ... have a jump from its middle to the next statement, so it is not sufficient simply to generate code for each statement in order.
asked Sep 7, 2019 in Compiler Design Lakshman Patel RJIT 44 views
0 votes
0 answers
22
Write L-attributed SDD's analogous to that of Example $5.19$ for the following productions, each of which represents a familiar flow-of-control construct, as in the programming language C. You may need to generate a three address statement to jump to a particular ... have a jump from its middle to the next statement, so it is not sufficient simply to generate code for each statement in order.
asked Sep 6, 2019 in Compiler Design Lakshman Patel RJIT 28 views
1 vote
1 answer
23
The following SDT computes the value of a string of $0's$ and $1's$ interpreted as a positive, binary integer. $B\rightarrow B_{1}0\:\{B.val=2\times B_{1}.val\}\mid B_{1}1\:\{B.val=2\times B_{1}.val+1\}\mid 1 \:\{B.val=1\}$ Rewrite this SDT so the underlying grammar is not left recursive, and yet the same value of $B.val$ is computed for the entire input string.
asked Sep 6, 2019 in Compiler Design Lakshman Patel RJIT 93 views
1 vote
1 answer
24
Rewrite the following SDT: $A\rightarrow A\{a\}B\mid AB\{b\}\mid 0$ $B\rightarrow B\{c\}A\mid BA\{d\}\mid 1$ so that the underlying grammar becomes non-left-recursive. Here, $a, b, c$, and $d$ are actions, and $0$ and $1$ are terminals.
asked Sep 6, 2019 in Compiler Design Lakshman Patel RJIT 119 views
0 votes
0 answers
25
0 votes
0 answers
26
Give an SDD to differentiate expressions such as $x\ast(3\ast x + x\ast x)$ involving the operators $+$ and $\ast,$ the variable $x$, and constants. Assume that no simplification occurs, so that, for example, $3\ast x$ will be translated into $3\ast 1+0\ast x$.
asked Sep 6, 2019 in Compiler Design Lakshman Patel RJIT 40 views
0 votes
0 answers
27
Give an SDD to translate infix expressions with $+$ and $\ast$ into equivalent expressions without redundant parentheses. For example, since both operators associate from the left, and $\ast$ takes precedence over $+, ((a\ast(b+c))\ast(d))$ translates into $a\ast(b + c)\ast d$.
asked Sep 6, 2019 in Compiler Design Lakshman Patel RJIT 43 views
0 votes
0 answers
28
Below is a grammar for expressions involving operator $+$ and integer or floating-point operands. Floating-point numbers are distinguished by having a decimal point. $E\rightarrow E+T\mid T$ $T\rightarrow num.num\mid num$ Give an SDD to determine the type ... SDD of $(a)$ to translate expressions into postfix notation.Use the unary operator intToFloat to turn an integer into an equivalent float.
asked Sep 6, 2019 in Compiler Design Lakshman Patel RJIT 110 views
0 votes
0 answers
29
Implement Algorithm $3.23$, which converts a regular expression into a nondeterministic finite automaton, by an L-attributed SDD on a top-down parsable grammar. Assume that there is a token char representing any character, and that char.$lexval$ is the character it ... that is, a state never before returned by this function. Use any convenient notation to specify the transitions of the $NFA$.
asked Sep 6, 2019 in Compiler Design Lakshman Patel RJIT 86 views
0 votes
1 answer
30
This grammar generates binary numbers with a "decimal" point: $S\rightarrow L.L\mid L$ $L\rightarrow LB\mid B$ $B\rightarrow 0\mid 1$ Design an S-attributed SDD to compute $S.val$, the decimal-number value of an input string. For example, the translation of string $101.101$ should be the decimal number $5.625$.
asked Sep 6, 2019 in Compiler Design Lakshman Patel RJIT 212 views
...