You are on page 1of 3

1. Explain phases of compiler in detail.

CO5
2. Discuss the actions taken by the compiler to process the following statements:
(i) p= interest + rate*100
(ii) area = 3.14 *r*r
(iii) int a,b=5,c=100;
3. Describe the analysis and synthesis phases of compiler. CO5
4. Distinguish between Compiler and Interpreter. CO5
5. Define the terms: (i) Lexeme, (ii) Token. CO5
6. Discuss the role of lexical analyzer in the phases of compiler. CO5
7. Show the output of lexical analyzer after processing of following code fragment:
while(i<5)
{
if(a>b)
c=a+b;
else
printf(“error”);
}
CO5
8. Convert the following CFG into non-left recursive CFG:
(i) E→E+T|T, T→T*F|F, F→id
(ii) S→SS+|SS*|a
CO5
9. Perform left-factoring on the CFG given below:
(i) S→iCtS | iCtSeS | a, C→ b
(ii) A→ abC | abCdXz, C→ Cc| c, X→ a
CO5
10. Compute FIRST & FOLLOW from the following productions:
(i) S→ ACB | Cbb | Ba, A→ DA | BC, B→ g | ε , C→ h | ε
(ii) S’→ S#, S→ qABC, A→ a | bbD, B→ b |ε, C→ c |ε, D→ d |ε
CO5
11. Construct LL(1) predictive parsing table for the grammar in above Question. CO5
12. Test whether following grammar is LL(1) or not. If it is LL(1), construct the
parsing table
for the same:
(i) S→1AB|ε , A→1AC|0C, B→0S, C→1
CO5
(ii) S→aA|AB, A →Ab|c, B→e|f
13. Define operator precedence grammar. CO5
14. Construct SLR(1) for the following grammar:
E→E+T|T, T→T*F|F, F→a|b
Show the acceptance for the string w=a+b*a
CO5
15. Construct predictive parser for the following grammar S→ (L)/a, L→L,S|S and
parse any
input string.
CO5
16. Construct an operator precedence table for the given grammar:
S→L=R|R, L→*R|id, R→L and construct operator precedence function table from
the parsing table.
CO5
17. Consider the following grammar: S→ AS|b, A →SA|a.
Construct the SLR parse table for the grammar. Show the actions of the parser for
the
input string “abab”.
CO5
18. Define Syntax-directed translation. CO5
19. Define the following:
(i) Annotated parse tree,
(ii) Dependency graph,
(iii) Syntax tree.
CO5
20. Define DAG. Give an example. CO6
21. Explain with an example to generate the intermediate code for the flow of
control
Statements.
CO6
22. Explain three address codes and its types with suitable examples. CO6
23. Define triples, indirect triples and quadruples. CO6
24. Translate the arithmetic expression a*-(b+c) into syntax tree and postfix
notation. CO6
25. Explain the various issues in the design of code generation. CO6
26. Write a short note on basic blocks and flow graphs. CO6
27. Explain the peephole optimization in detail. CO6
28. Define a Directed Acyclic graph. Construct a DAG and write the sequence of
Instructions
for the expression “a+a*(b-c)+(b-c)*d”.
CO6
29. Discuss the various issues in code generation with examples. CO6
30. Define Peephole Optimization. CO6
31. Discuss machine dependent code optimization. CO6
32. Define flow graph. CO6
33. Explain the machine dependent and independent techniques. CO6
34. What is the purpose of code optimization? Explain in detail about loop
Optimization with
example.
CO6
35. Discuss in detail the process of optimization of basic blocks. Give an example.
CO6
36. Write global common sub-expression elimination with an example. CO6
37. Explain the following code optimization techniques with examples:
a) Constant propagation, b) Strength reduction, c) Code Motion.
CO6
38. What is an LR(0) item? Construct an SLR parsing table for the grammar G:
S→ L=R |R, L → *R | id, R → L. Is it SLR(1) grammar?
CO6
39. Discuss the a translation scheme for Converting an infix expression to its
equivalent
postfix form.
CO6
40. Generate 3-address code for the following C program and construct flow graph
with the
help of basic blocks :
main() {
int i=1;
int a[10];
while(i<=10)
{ a[i]=0;
i++; }
}
CO6
41. Generate 3-address code for the following C program and construct flow graph
with the
help of basic blocks : (assume 4 memory locations for integer ):
min=a[0];
for (i=1;i<n;i++)
if(a[i]<min)
min=a[i];
flag=1;
CO6
42. Generate 3-address code for the following C program and construct flow graph
with the
help of basic blocks :
i=1; j=1;x=5;
while(i<3)
{
switch(i)
{
case 1: a[j++]=i+x;
break;
case 2: a[j++]=i-x;
break;
}
i++;
}
CO6
43. Apply possible code optimization techniques for basic blocks in Q.40 to Q.42 to
generate
optimized code.
CO6
44. Design a predictive parser for the given grammar. Mention all the steps:
E→TQ
T→FR
Q→+TQ|-TQ|ε
R→*FR|/FR|ε
F→(E)|id
CO5
45. Explain the design of absolute leaders and mention all data structures in
detail. CO4
46. Explain dynamic link loader. CO4
47. Define loader. Describe functions of loader. CO4
48. Discuss direct linking loader. CO4
49. Explain bootstrap loader. CO4
50. Discuss the databases used in direct linking loader. CO4

You might also like