PRAGATI ENGINEERING COLLEGE
# 1-378, ADB Road, Surampalem, E.G.Dist., A.P. – 533 437
(Approved by AICTE, New Delhi & Affiliated to JNT University, Kakinada)
Ph: (08852) – 252233, 252234, 252235 ,Fax: (08852) – 252232
(Sponsored by Gayatri Educational Society, Kakinada)
DEPARTMENT OF COMPUTER SCIENCE ENGINEERING
III Year B.Tech Computer Science Engineering - I Semester(2015-16)
Subject: Compiler Design
ASSIGNMENT 1
1.What is Language processing.Explain about preprocessors,linkers,assemblers and loaders?
2.What are various phases of the compiler?Explain each phase in detail.Write down the output of
each phase for the expression a=b+c*50
3. Define and explain the following with examples?
a)lexemes b)patterns c)tokens d)lexical errors e)LEX tool
4. What is role of lexical analyzer? Write difference between lexical analysis and parsing?
5. Explain about the following
a)Regular expressions b)Regular definitions c)Transition diagrams for tokens and identifiers
ASSIGNMENT 2
1) E -> TE1
E1-> +TE1
E1->Є
T -> FT1
T1 -> *FT1
T1-> Є
F -> (E)
F -> id
construct predictive parse table and show the stack implementation of id+id*id.
2.check whether the following grammar is LL(1) or not?
S->iEtS|iEtSES|a
E -> b
3.Construct LL(1) Parse table for the following grammar?
S -> L=R | R
L -> *R | id
R -> L
4.Explain Error Recovery strategies in Predictive Parsing?
5.Explain about Recursive Descent parsing?
ASSIGNMENT 3
1.consider the following grammar
S -> E1
E1 -> T3E1| T1
E1 -> T3E2 | T2
T1 -> a$ | (E2$
T2 -> a) | (E2)
T3 -> a+ | (E2+
find canonical set of items
2.a)What is shift /reduce and reduce/reduce conflicts.How these can be resolved. with examples
explain in which condition S-R and R-R conflicts can occur in SLR,CLR,LALR parsers.
b) Differentiate between LL,LR parsers?
3) Construct SLR pasre table for the following grammar
E -> E+T|T
T -> T*F|F
F->(E)|id
4)Costruct CLR Parse table for the following grammar?
S -> CC
C -> aC|d
5)Costruct LALR Parse table for the following grammar?
S -> CC
C -> aC
C -> d
6)Explain error recovery in LR parsing?
ASSIGNMENT 4
1)Write Quadruples, Triples, Indirect triples for the expression x= -a*b + -a*b ?
2)Explain about evaluation of semantic rules?
3)Explain about abstract syntax trees with suitable examples?
4)Explain about Types and declarations, type Checking?
5) Explain about semantic analysis?
ASSIGNMENT 5
1) What is symbol table?Explain how symbol table is organized?
2) Explain in detail about runtime stack and heap management?
3)Explain about Peephole optimization?
4)Explain about Register allocation and assignment?
5)How nonlocal data is accessed?Explain in detail?
ASSIGNMENT 6
1)Explain about global common sub expression elimination,
2)Explain about copy propagation, dead code elimination?
3)Explain about constant folding, strength reduction, loop optimization?
4)Explain about the following?
a)Instruction scheduling b)inter procedural optimization.