# Anna University Principles of Compiler Design question paper 2004 CS337 4th Sem questions

Download B.E / B.Tech. Degree exam question paper CS337 Principles of Compiler Design question paper of Anna University.

The following resource will give you the details about the previous year question paper of CS337 and the course name is Principles of Compiler Design of Anna university.

Anna University question papers:CS337 Principles of Compiler Design Examination Question Papers of previous years. Check the resource below of Anna university semester 4th CS337 question paper

Part-A
1. What is CFG?Explain with an example?
2. What are the cousins of compiler?
3. Draw the NFA for a*/b*.
4. What are sentinels?Discuss their usage?
5. Define handle pruning.
6. What are the LR(0) items.
7. How do you represent an equation using DAG a:=b*-c+b*-c.What is the purpose of DAG?
8. What is the intermediate code representation for expression a or b and not c.
9. How do you calculate the cost of an instruction?
10. What is defined as code motion?

Part-B

11. i.Explain various phases of a compiler in detail.Also write down the output for the following expression after each phase a:=b*c-d.(10 marks)
ii.Briefly explain compiler construction tools.

12. a.For regular expression (a|b)*a(a|b)draw NFA.Obtain DFA from NFA.Minimise DFA using ?new construction.Write algorithm wherever necessary.

(or)
b.i.How you get a DFA from a Regular expression?Obtain DFA for an regular expression.(10 marks) (a/b)*a(a/b)(a/b)
ii.What are necessary conditions to be carried out before the construction of predictive parser.

13. a.i.Construct a predictive parser.(12 marks)
S->(L)/a L->L,S/S
ii.Construct behaviour of parser on the sentence (a,a) using grammar specified.
(or)
b.i.What is the operator grammar?Draw the precedence function graph for the following table.

a ( ) , \$
a > > >
( < < = <
) > > >
, < < > >
\$ < <
ii.Check whether following grammar is SLR(1) or not.Explain the answer with reasons.
S->L=R S->R L->*R L->id R->L
14. a.Explain various structures that are used for the symbol table construction.

(or)
b.How would you generate the intermediate code for the flow of control statements?Explain with example?

15. a.i.Briefly explain issues in design of code generator.
ii.Explain peep hole optimization.
(or)
b.Explain principle source of optimization.