Sie sind auf Seite 1von 2

April/May 2004

CS337-Principles of Compiler Design


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.

Das könnte Ihnen auch gefallen