CD Unit Test 2
CD Unit Test 2
NO:
8131- PAVENDAR BHARATHIDASAN COLLEGE OF ENGINEERING AND 8131- PAVENDAR BHARATHIDASAN COLLEGE OF ENGINEERING AND
TECHNOLOGY, MATHUR-TIRUCHIRAPPALLI-620024 TECHNOLOGY, MATHUR-TIRUCHIRAPPALLI-620024
B.E/B.TECH –UNIT TEST II- MAR 2018 B.E/B.TECH –UNIT TEST II- MAR 2018
SIXTH SEMESTER SIXTH SEMESTER
COMMON TO CSE/ IT COMMON TO CSE/ IT
CS6660 / COMPILER DESIGN CS6660 / COMPILER DESIGN
TIME: 1 HOUR 30 MIN MAXIMUM MARKS: 50 TIME: 1 HOUR 30 MIN MAXIMUM MARKS: 50
ANSWER ALL QUESTION ANSWER ALL QUESTION
PART A- (10*2=20 MARKS) PART A- (10*2=20 MARKS)
1. Define parser. 1. Define parser.
2. Mention the basic issues in parsing. 2. Mention the basic issues in parsing.
3. Define a context free grammar. 3. Define a context free grammar.
4. Define ambiguous grammar. 4. Define ambiguous grammar.
5. What are the problems with top down parsing? 5. What are the problems with top down parsing?
6. Write short notes on YACC. 6. Write short notes on YACC.
7. Define LR(0) items. 7. Define LR(0) items.
8. What is meant by handle pruning? 8. What is meant by handle pruning?
9. What is meant by viable prefixes? 9. What is meant by viable prefixes?
10. What is phrase level error recovery? 10. What is phrase level error recovery?
11. a) Construct parsing table for the grammar and find moves made by predictive parser on 11. a) Construct parsing table for the grammar and find moves made by predictive parser on
input 1d+id*id and find FIRST and FOLLOW. input 1d+id*id and find FIRST and FOLLOW.
E->E+T/T,T->T*F/F,F->(E)/id (15) (OR) E->E+T/T,T->T*F/F,F->(E)/id (15) (OR)
b) Construct stack implementation of shift reduce parsing for the grammar b) Construct stack implementation of shift reduce parsing for the grammar
S -> (L)|a,L -> L,S|S. To check whether the sentence (a,(a,a)).(15) S -> (L)|a,L -> L,S|S. To check whether the sentence (a,(a,a)).(15)
12. a) Construct Predictive Parsing table for the following grammar: S ->(L)/a, L -> L, S/S 12. a) Construct Predictive Parsing table for the following grammar: S ->(L)/a, L -> L, S/S
and check whether the following sentences belong to that grammar or not.(15) and check whether the following sentences belong to that grammar or not.(15)
i) (a,a) i) (a,a)
ii) (a, (a ,a)) ii) (a, (a ,a))
b) Construct SLR parsing Table for the following grammar: b) Construct SLR parsing Table for the following grammar:
E→E+T|T,T→T*F|F,F→(E)|id. (15) E→E+T|T,T→T*F|F,F→(E)|id. (15)