0% found this document useful (0 votes)
29 views

CT3 QB

The document discusses compiler design topics like syntax analysis, intermediate code generation, code optimization techniques, runtime storage management and code generation. It includes questions related to evaluating expressions on SDD parse trees, analyzing desk calculator grammar and syntax trees, implementing three address codes, bottom-up evaluation, L-attributed definitions, synthesized and inherited attributes, generating intermediate code, issues in cross compilers and code generators, parameter passing methods, storage organization, activation records, data flow equations, DAG representation and constructing DAGs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

CT3 QB

The document discusses compiler design topics like syntax analysis, intermediate code generation, code optimization techniques, runtime storage management and code generation. It includes questions related to evaluating expressions on SDD parse trees, analyzing desk calculator grammar and syntax trees, implementing three address codes, bottom-up evaluation, L-attributed definitions, synthesized and inherited attributes, generating intermediate code, issues in cross compilers and code generators, parameter passing methods, storage organization, activation records, data flow equations, DAG representation and constructing DAGs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

UNIT –IV

1. Evaluate the expressions for the SDD annotated parse tree for the follow expressions.
a) 3 * 5 + 4n
b) (3 + 4) * (5 + 6)
2. (i)Analyze the grammar and syntax-directed translation for desk calculator
(ii) Explain how the procedure of constructing syntax tree from SDD
3. What is three address codes. Mention the types. How would you implement the three
address statement with an example.
4. Write about Bottom-Up evaluation S-Attributed definitions.
5. What is L-attributed definition? Give some example.
6. Explain synthesized attribute and inherited attribute with suitable examples.
7. Generate an intermediate code for the following code segment with the required syntax-
directed translation scheme. if ( a > b) x = a + b else x = a – b
8. What is cross compiler, explain its issues and give T-diagram representation.
9. (i) What are the issues in the design of code generator?
(ii) Explain simple code generator with suitable example.
10. Write a code generation algorithm. Explain about the descriptor and function getreg().
Generate a code for x = (( a + b) / (b-c)) – ( a + b) * ( b-c) +f.

UNIT –V

1. Explain in detail about stack allocation space.


2. Draw the activation tree for the quick soft algorithm.
3. Let fib(n) be the function
int fib(n) {
if (n == 0)
return 0;
else if (n == 1)
return 1;
else
return fib(n-1) + fib(n-2)}
I. Show the activation tree for fib(3).
II. Show the activation records that are on the run-time stack when fib(1) is invoked for
the first time during the invocation of fib(3). Just show four fields in each activation
record: the returned value, the argument, the control link (which is a pointer the caller's
AR), and the return address.
III. As a function of n, what is the time complexity of this program?
4. Explain in detail about parameter passing methods
5. (i) Describe the source language issues in detail.
(ii) Describe in detail about storage organization.
(ii) Explain about activation records and its purpose.
6. Give the data flow equation and state the use of gen, kill, in an out function
7. Explain principal source of optimization methods
8. Define DAG, state its applications and construct DAG
S1:= 4 * i
S2:= a[S1]
S3:= 4 * i
S4:= b[S3]
S5:= s2 * S4
S6:= prod + S5
Prod:= s6
S7:= i+1
i := S7
if i<= 20 goto (1)

You might also like