Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Recent questions tagged ullman
0
votes
1
answer
1
compiler design tcompiler-design-timothy-g-griffin
6. Generate code for the following C program using any code generation algorithm. [3 Marks] main() { int x, a, b, c, d, e; x= a + b -( c + d ) * e }
6. Generate code for the following C program using any code generation algorithm. [3 Marks] main() { int x, a, b, c, d, e; ...
Ebrahim
144
views
Ebrahim
asked
Jan 31
Compiler Design
compiler-design
syntax-directed-translation
code-optimization
parsing
ullman
+
–
0
votes
1
answer
2
Compiler-design
Q1. For the following grammar N -> AB | BA A -> a | CAC B -> b | CBC C -> a | b Find the FIRST and FOLLOW
Q1. For the following grammar N - AB | BA A - a | CAC B - b | CBC C - a | b Find the FIRST and FOLLOW
Ebrahim
171
views
Ebrahim
asked
Jan 12
Compiler Design
compiler-design
syntax-directed-translation
lexical-analysis
ullman
parsing
+
–
0
votes
0
answers
3
compiler-design-timothy-g-griffin
Find the FIRST and FOLLOW of the grammar to check whether it is LL (1) parser or not. N → AB | BA A → a | CAC B → b | CBC C → a | b
Find the FIRST and FOLLOW of the grammar to check whether it is LL (1) parser or not. N → AB | BA A → a | CAC B → b | CBC C → a | b
Ebrahim
106
views
Ebrahim
asked
Jan 11
Compiler Design
compiler-design
parsing
ullman
syntax-directed-translation
code-optimization
+
–
1
votes
0
answers
4
Ullman (Compiler Design) Edition 2 Exercise 6.5 Question 2 (Page No. 399)
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 ... of the overall expression is determined, proceeds top-down to determine attribute $unique$ for the type of each subexpression.
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 app...
admin
1.0k
views
admin
asked
Sep 7, 2019
Compiler Design
ullman
compiler-design
intermediate-code
three-address-code
descriptive
+
–
0
votes
0
answers
5
Ullman (Compiler Design) Edition 2 Exercise 6.5 Question 1 (Page No. 398)
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)$
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 cha...
admin
691
views
admin
asked
Sep 7, 2019
Compiler Design
ullman
compiler-design
intermediate-code
three-address-code
descriptive
+
–
0
votes
0
answers
6
Ullman (Compiler Design) Edition 2 Exercise 6.4 Question 9 (Page No. 386)
$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. ...
admin
534
views
admin
asked
Sep 7, 2019
Compiler Design
ullman
compiler-design
intermediate-code
three-address-code
descriptive
+
–
0
votes
1
answer
7
Ullman (Compiler Design) Edition 2 Exercise 6.4 Question 8 (Page No. 386)
$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]$
$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. ...
admin
868
views
admin
asked
Sep 7, 2019
Compiler Design
ullman
compiler-design
intermediate-code
three-address-code
descriptive
+
–
0
votes
0
answers
8
Ullman (Compiler Design) Edition 2 Exercise 6.4 Question 7 (Page No. 386)
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.
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 starti...
admin
903
views
admin
asked
Sep 7, 2019
Compiler Design
ullman
compiler-design
intermediate-code
three-address-code
descriptive
+
–
0
votes
1
answer
9
Ullman (Compiler Design) Edition 2 Exercise 6.4 Question 6 (Page No. 386)
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]$
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 starti...
admin
542
views
admin
asked
Sep 7, 2019
Compiler Design
ullman
compiler-design
intermediate-code
three-address-code
descriptive
+
–
0
votes
0
answers
10
Ullman (Compiler Design) Edition 2 Exercise 6.4 Question 5 (Page No. 385 - 386)
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 ... $h_{j}$.The same as $(c)$ but with the array stored in column-major form.
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 case...
admin
351
views
admin
asked
Sep 7, 2019
Compiler Design
ullman
compiler-design
intermediate-code
three-address-code
descriptive
+
–
0
votes
0
answers
11
Ullman (Compiler Design) Edition 2 Exercise 6.4 Question 4 (Page No. 385)
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.
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.
admin
378
views
admin
asked
Sep 7, 2019
Compiler Design
ullman
compiler-design
intermediate-code
three-address-code
descriptive
+
–
0
votes
0
answers
12
Ullman (Compiler Design) Edition 2 Exercise 6.4 Question 3 (Page No. 385)
Use the translation of Fig. $6.22$ to translate the following assignments: $x=a[i]+b[j]$ $x=a[i][j]+b[i][j]$ $x=a[b[i][j]][c[[k]]$
Use the translation of Fig. $6.22$ to translate the following assignments: $x=a[i]+b[j]$$x=a[i][j]+b[i][j]$$x=a[b[i][j]][c[[k]]$
admin
696
views
admin
asked
Sep 7, 2019
Compiler Design
ullman
compiler-design
intermediate-code
three-address-code
descriptive
+
–
0
votes
0
answers
13
Ullman (Compiler Design) Edition 2 Exercise 6.4 Question 2 (Page No. 384)
Add to the translation of Fig. $6.19$ rules for the following productions: $E\rightarrow E_{1}\ast E_{2}$ $E\rightarrow + E_{1}\:$(unary plus)
Add to the translation of Fig. $6.19$ rules for the following productions:$E\rightarrow E_{1}\ast E_{2}$$E\rightarrow + E_{1}\:$(unary plus)
admin
439
views
admin
asked
Sep 7, 2019
Compiler Design
ullman
compiler-design
intermediate-code
three-address-code
descriptive
+
–
0
votes
0
answers
14
Ullman (Compiler Design) Edition 2 Exercise 6.4 Question 1 (Page No. 384)
Add to the translation of Fig. $6.19$ rules for the following productions: $E\rightarrow E_{1}\ast E_{2}$ $E\rightarrow + E_{1}\:$(unary plus)
Add to the translation of Fig. $6.19$ rules for the following productions:$E\rightarrow E_{1}\ast E_{2}$$E\rightarrow + E_{1}\:$(unary plus)
admin
587
views
admin
asked
Sep 7, 2019
Compiler Design
ullman
compiler-design
intermediate-code
three-address-code
descriptive
+
–
0
votes
0
answers
15
Ullman (Compiler Design) Edition 2 Exercise 6.3 Question 2 (Page No. 378)
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 ... inherited fields. Inherited fields must maintain the relative addresses they were assigned in the layout for the superclass.
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 tab...
admin
481
views
admin
asked
Sep 7, 2019
Compiler Design
ullman
compiler-design
three-address-code
intermediate-code
descriptive
+
–
0
votes
0
answers
16
Ullman (Compiler Design) Edition 2 Exercise 6.3 Question 1 (Page No. 378)
Determine the types and relative addresses for the identifiers in the following sequence of declarations: float x; record { float x; float y; } p; record { int tag; float x; float y; } q;
Determine the types and relative addresses for the identifiers in the following sequence of declarations:float x; record { float x; float y; } p; record { int tag; float ...
admin
1.2k
views
admin
asked
Sep 7, 2019
Compiler Design
ullman
compiler-design
three-address-code
intermediate-code
descriptive
+
–
0
votes
1
answer
17
Ullman (Compiler Design) Edition 2 Exercise 6.2 Question 3 (Page No. 370)
Show how to transform a three-address code sequence into one in which each defined variable gets a unique variable name.
Show how to transform a three-address code sequence into one in which each defined variable gets a unique variable name.
admin
1.7k
views
admin
asked
Sep 7, 2019
Compiler Design
ullman
compiler-design
three-address-code
intermediate-code
descriptive
+
–
1
votes
1
answer
18
Ullman (Compiler Design) Edition 2 Exercise 6.2 Question 2 (Page No. 370)
Translate the following arithmetic expression into: $a=b[i]+c[j]$ $a[i]=b\ast c-b\ast d$ $x=f(y+1)+2$ $x=\ast p + \&y$ A Syntax tree Quadruples Triples Indirect triples
Translate the following arithmetic expression into:$a=b[i]+c[j]$$a[i]=b\ast c-b\ast d$$x=f(y+1)+2$$x=\ast p + \&y$ A Syntax treeQuadruplesTriplesIndirect triples
admin
8.0k
views
admin
asked
Sep 7, 2019
Compiler Design
ullman
compiler-design
three-address-code
intermediate-code
descriptive
+
–
0
votes
1
answer
19
Ullman (Compiler Design) Edition 2 Exercise 6.2 Question 1 (Page No. 370)
Translate the arithmetic expression $a + -(b + c)$ into: A syntax tree. Quadruples. Triples. Indirect triples
Translate the arithmetic expression $a + -(b + c)$ into:A syntax tree.Quadruples.Triples.Indirect triples
admin
11.0k
views
admin
asked
Sep 7, 2019
Compiler Design
ullman
compiler-design
three-address-code
intermediate-code
descriptive
+
–
0
votes
1
answer
20
Ullman (Compiler Design) Edition 2 Exercise 6.1 Question 2 (Page No. 363)
Construct the DAG and identify the value numbers for the subexpressions of the following expressions, assuming $+$ associates from the left. $a+b+(a+b)$ $a+b+a+b$ $a+a+((a+a+a+(a+a+a+a))$
Construct the DAG and identify the value numbers for the subexpressions of the following expressions, assuming $+$ associates from the left.$a+b+(a+b)$$a+b+a+b$$a+a+((a+a...
admin
4.8k
views
admin
asked
Sep 7, 2019
Compiler Design
ullman
compiler-design
three-address-code
directed-acyclic-graph
descriptive
+
–
1
votes
2
answers
21
Ullman (Compiler Design) Edition 2 Exercise 6.1 Question 1 (Page No. 362)
Construct the DAG for the expression $((x + y)-((x + y)\ast(x -y))) + ((x+y)\ast(x-y))$
Construct the DAG for the expression$((x + y)-((x + y)\ast(x -y))) + ((x+y)\ast(x-y))$
admin
2.6k
views
admin
asked
Sep 7, 2019
Compiler Design
ullman
compiler-design
three-address-code
directed-acyclic-graph
descriptive
+
–
0
votes
0
answers
22
Ullman (Compiler Design) Edition 2 Exercise 5.4 Question 7 (Page No. 337)
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$.
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...
admin
605
views
admin
asked
Sep 6, 2019
Compiler Design
ullman
compiler-design
syntax-directed-translation
grammar
descriptive
+
–
0
votes
0
answers
23
Ullman (Compiler Design) Edition 2 Exercise 5.4 Question 6 (Page No. 337)
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$.
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 ea...
admin
635
views
admin
asked
Sep 6, 2019
Compiler Design
ullman
compiler-design
syntax-directed-translation
grammar
descriptive
+
–
0
votes
0
answers
24
Ullman (Compiler Design) Edition 2 Exercise 5.4 Question 5 (Page No. 337)
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 ... middle to the next statement, so it is not sufficient simply to generate code for each statement in order.
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 progr...
admin
482
views
admin
asked
Sep 6, 2019
Compiler Design
ullman
compiler-design
syntax-directed-translation
grammar
descriptive
+
–
0
votes
0
answers
25
Ullman (Compiler Design) Edition 2 Exercise 5.4 Question 4 (Page No. 337)
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 ... middle to the next statement, so it is not sufficient simply to generate code for each statement in order.
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 progr...
admin
450
views
admin
asked
Sep 6, 2019
Compiler Design
ullman
compiler-design
syntax-directed-translation
grammar
descriptive
+
–
1
votes
1
answer
26
Ullman (Compiler Design) Edition 2 Exercise 5.4 Question 3 (Page No. 337)
The following SDT computes the value of a string of $0's$ and $1's$ ... so the underlying grammar is not left recursive, and yet the same value of $B.val$ is computed for the entire input string.
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...
admin
2.1k
views
admin
asked
Sep 6, 2019
Compiler Design
ullman
compiler-design
syntax-directed-translation
grammar
left-recursion
descriptive
+
–
1
votes
1
answer
27
Ullman (Compiler Design) Edition 2 Exercise 5.4 Question 2 (Page No. 336 - 337)
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.
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...
admin
789
views
admin
asked
Sep 6, 2019
Compiler Design
ullman
compiler-design
syntax-directed-translation
grammar
descriptive
+
–
0
votes
0
answers
28
Ullman (Compiler Design) Edition 2 Exercise 5.4 Question 1 (Page No. 336)
We mentioned in Section $5.4.2$ that it is possible to deduce, from the LR state on the parsing stack, what grammar symbol is represented by the state. How would we discover this information?
We mentioned in Section $5.4.2$ that it is possible to deduce, from the LR state on the parsing stack, what grammar symbol is represented by the state. How would we disco...
admin
510
views
admin
asked
Sep 6, 2019
Compiler Design
ullman
compiler-design
syntax-directed-translation
grammar
descriptive
+
–
0
votes
0
answers
29
Ullman (Compiler Design) Edition 2 Exercise 5.3 Question 3 (Page No. 323)
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$.
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 simpli...
admin
487
views
admin
asked
Sep 6, 2019
Compiler Design
ullman
compiler-design
syntax-directed-translation
+
–
0
votes
0
answers
30
Ullman (Compiler Design) Edition 2 Exercise 5.3 Question 2 (Page No. 323)
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$.
Give an SDD to translate infix expressions with $+$ and $\ast$ into equivalent expressions without redundant parentheses. For example, since both operators associate from...
admin
756
views
admin
asked
Sep 6, 2019
Compiler Design
ullman
compiler-design
syntax-directed-translation
infix-expressions
+
–
Page:
1
2
3
4
5
6
...
11
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register