Roll No.
ARASU ENGINEERING COLLEGE, KUMBAKONAM-612 501
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
INTERNAL ASSESSMENT TEST – I
Year/Sem./Branch : III / V / CSE Max. Marks : 100
Sub. Code & Name : CS3501 – COMPILER DESIGN Duration : 3 hours
Date & Session : 22.09.23
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 OUTCOMES
CODE (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. Write a regular expression to represent all possible numbers [CO1, LOT, K1]
(integer,float, and exponential)
2. Compare compiler & interpreter. [CO1,LOT,K4]
3. Explain parse tree and construct a parse tree for –(id + id) [CO1, LOT, K1]
Define handle pruning. [CO2,LOT,K1]
4.
List out the properties of parse tree. [CO2, LOT, K1]
5.
Write the rule to eliminate left recursion in a grammar. Prepare and [CO2,LOT,K4]
6.
Eliminate the left recursion for the grammar.
S → Aa | b
A →Ac | Sd |ε
List out the two rules for type checking. [CO2, LOT, K1]
7.
What is a syntax tree? Draw the syntax tree for the assignment [CO3, LOT, K1]
8.
statement a := b * -c + b * -c
State type expressions. [CO3, LOT, K1]
9.
[CO3, LOT, K1]
10. Summarize about the S-attributed definition?
PART – B (5X13=65 Marks)
11. a. Describe the various phases of compiler with suitable example [CO1, HOT, K3]
(or)
b. Summarize in detail about how the tokens are specified by the [CO1,HOT, K3]
Compiler with suitable example.
12. a. Define the language accepted by FA. Convert the following NFA into [CO1, HOT, K3]
DFA.
0 1
p {p,q} {p}
.
q {r} {r}
r {s} ɸ
*s {s} {s}
(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. (i) Compute FIRST and FOLLOW for the following grammar. [CO2, HOT, K5]
E→E+T | T
T→T*F | F
F→(E) | 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:
i) Give the comparison for various parsers. [CO2,HOT,K4]
ii) Give the structure of YACC program
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. Create the following arithmetic expression a=b*-c+b*-c into [CO3, HOT, K6]
(i)Syntax tree
(ii)Quadruples
(iii)Triples
(iv)Indirect Triples
Part – C (1 X 15 = 15 Marks)
16.a. Create variants of Syntax tree. Explain in detail about it with suitable [CO3, HOT, K6]
examples.
(or)
b. Define three address code. Describe the various methods of [CO3, HOT, K5]
implementing three address statements with an example.