Roll No.
ARASU ENGINEERING COLLEGE, KUMBAKONAM-612 501
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
INTERNAL ASSESSMENT TEST – I
Year/Sem./ : III / V / CSE Max. Marks : 100
Branch
Sub. Code & : CS3501 – COMPILER DESIGN Duration : 3 hours
Name
Date & Session :
The IAT – I is used to assess the course outcomes CO1, CO2 & CO3 Lower Order Thinking
(LOT) and Higher Order Thinking (HOT) of the course.
K1 – Remembering K2 – Understanding. K3 –
Applying K4 – Analyzing. K5 – Evaluating. K6 –
Creating.
COURSE COURSE
CODE OUTCOMES (COs)
C302.1 Understand the techniques in different phases of a compiler.
C302.2 Design a lexical analyser for a sample language and learn to use
the LEX tool.
C302.3 Apply different parsing algorithms to develop a parser and learn to
use YACC tool
Answer all the Question
PART – A (10X2=20 Marks)
1. Define compiler. [CO1,LOT,K1]
2. Define error recovery strategies. [CO1,LOT,K2]
3. Mention few cousins of the Compiler. [CO1,LOT,K1]
4. What is left factoring? [CO2,LOT,K1]
5. List out the properties of parse tree. [CO2, LOT,K1]
6. Define Shift-Reduce parser. [CO2, LOT,K1]
7. List the types of grammars. [CO2,LOT,K1]
8. Explain the syntax directed definition for if-else statement. [CO3,LOT,K1]
9. Differentiate S-attribute and L-attribute definitions. [CO3,LOT,K2]
10. What is meant by Back patching? [CO3,LOT,K1]
PART – B (5X13=65 Marks)
11. a. Describe the various phases of compiler with suitable example [CO1,HOT,K3]
(or)
b. (i)Explain the role of lexical analyzer in detail. [CO1,HOT,K4]
(ii) Write brief note on specification of tokens with suitable examples. [CO1,HOT,K4]
12. a. Define 0 1 [CO1, HOT, K3]
the p {p,q} {p}
q {r} {r}
r {s} ɸ
*s {s} {s}
language accepted by FA. Convert the following NFA into DFA.
(or)
b. Define Finite Automata. Differentiate Deterministic Finite Automata
[CO1, HOT, K3]
and Non-Deterministic Finite Automata with examples.
13. a.
Construct the SLR parser and parse the sentence cdd and ccdd for [CO2,HOT,K6]
the grammar. S→CC,C→cC/d.
(or)
b. Construct Stack implementation of shift reduce parsing for the [CO2, HOT, K5]
grammar
E->E+E
E->E*E
E->(E)
E->id and the input string id+id*id
14. a. Check whether the following grammar can be implemented using [CO2,HOT,K5]
predictive parser check whether the string “abfg” is accepted or not
using predictive parsing.
A->A
A->aB/Ad
B->bBC/f
C->g
(or)
b. Explain the following: [CO2, HOT, K4]
i) Give the comparison for various parsers.
ii) Give the structure of YACC program [CO2, HOT, K4]
15. a. Discuss the following in detail about the Syntax Directed Definitions. [CO3, HOT, K6]
(i)Inherited Attributes and Synthesized attributes.
(ii)Evaluate SDD of a parse tree for the expression (4+7.5*3)/2 [CO3, HOT, K5]
(or)
b. Translate the following switch statement into intermediate code. [CO3, HOT, K6]
switch E
begin
case V1 :S1
case V2 : S2
case Vn-1: Sn-1
default: Sn
end
Part – C (1 X 15 = 15 Marks)
16.a. Explain in detail about the specification of a simple type checker. [CO3,HOT,K5]
(or)
b. Give SLR parser for the following grammar. [CO2, HOT, K5]
E→ E+T | T
T→ T*F | F
F→(E) | id
.