Tuesday, April 23, 2013

Compiler Design Important Questions for Exam

1. Explain the phases of compiler, with the neat schematic.
2. Explain in detail about compiler constructions tools.
3. Draw pictures of DFAs for each of the follwing regular expressions.
a.      (a/b)*c/d
b.      Ab*/cd*
4. Given the regular expression RE = a.(b*).(aa | a) over the alphabet = {a,b} answer the following tions: 
 Derive the NFA corresponds to this RE.
 Convert this NFA to a DFA using the closure computation.

5. Explain in detail about the role of lexical analyzer.
6. Explain briefly in detail about the Input buffering technique with the algorithm.
7. Describe the contents of a symbol table. How is the Symbol table involved in the
Interactions between the different components of the compiler and in error detection?

 8. Find the predictive parser for the given grammer and parse the sentence (a+b)*c.
 9.  Generate intermediate code for the following code segment along with the required syntax directed translation scheme.
  i)     if(a>b)
             where a & x are of real and b of int type data.

ii) int a,b;
              float c;
                   case 10: c=1;
                   case 20: c=2;

10. Construct predictive parsing table for the grammar
S->(L) | a
L->L,S | S

11. Construct DAG for the following basic block.                                       
                  T1 := A + B
                  T2 := C + D
                  T3 := E - T2
                  T4 := T1 - T3

12. Consider the following grammar G for expressions and lists of statements (StatList) using assignment statements (Assign) and basic expressions (Expr) with the productions presented below and already augmented by the intitial production G StatList $.

(0)  G StatList $
(1)  StatList Stat ‘; StatList
(2)  StatList Stat
(3)  Stat         Assign
(4)  Assign id = Expr
(5)  Expr id
(6)  Expr const

For the grammar presented above determine the following:
 Compute the DFA that recognizes the set of LR(0) items.
 Construct the LR(0) parsing table.
 Identify the nature of and explain how to resolve any conflicts in the table found in .

13. Construct a parse tree of (a+b)*c for the grammar E->E+E | E*E | (E) | id.
14. Construct the SLR parsing table for the given grammar and parse the sentence (a+b)*c.                E->E+E | E*E | (E) | id.

15. Define three address code. Describe the various types &methods of implementing three address statements with an example.
16. Explain different storage allocation strategies. 

17. Generate intermediate code for the following code segment:  
i=1; s=0;

18. Explain (1) Storage organization
                             (2) Parameter passing

19. Define back patching with an example.
20. Define basic block and flow graph.
21. Discuss briefly about DAG representation of basic blocks. Draw DAG for

22. Discuss briefly about peephole optimization.
23. Explain the various issues in the design of code generation.
24. Explain global data flow analysis.
25. Describe in detail about optimization of basic blocks with example.
26. Explain in detail about code- improving transformations.
27. Describe in detail about principal sources of optimization.


Post a Comment