0% found this document useful (0 votes)
137 views4 pages

Compiler Design

The document is an end semester examination for a Compiler Design course. It contains 3 sections - Section A with short 5 mark questions, Section B with 10 mark short/brief note questions, and Section C with 20 mark long answer questions. The questions test various concepts of compiler design including symbol tables, parsing techniques, code optimizations, code generation from intermediate representations, and error recovery strategies.

Uploaded by

Sanidhya Jadaun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
137 views4 pages

Compiler Design

The document is an end semester examination for a Compiler Design course. It contains 3 sections - Section A with short 5 mark questions, Section B with 10 mark short/brief note questions, and Section C with 20 mark long answer questions. The questions test various concepts of compiler design including symbol tables, parsing techniques, code optimizations, code generation from intermediate representations, and error recovery strategies.

Uploaded by

Sanidhya Jadaun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Name:

Enrollment No:

UNIVERSITY OF PETROLEUM AND ENERGY STUDIES


Online End Semester Examination, December 2020

Course: Compiler Design Semester: V


Program: B.Tech- CSE (All Branches) Time: 03 Hrs
Course Code: CSEG 3015 Max. Marks: 100

Instructions: Attempt all the questions.

SECTION A
1. Each Question carries 5 Marks.
2. Instruction: Write short notes / Select the correct answer(s).
S.No. CO
Q1 List down the fields in the activation record. CO4
Q2 Describe the role of symbol table in compiler CO4
Q3 State the problems with Top-Down Parsing. CO2
Q4 State the difference between synthesized attributes and inherited attributes. CO3
Q5 Which of the following is the most suitable alphabet for the language L = {SHAKTI, SHIVA,
RAM}
(a) {A, H, I, K, M, R, S, T, V, N}
CO1
(b) {A, H, I, K, M, R, S, T, V}
(c) {a, h, i, k, m, r, s, t, v}
(d) {a, h, k, k, m, R, S, t, v}
Q6 DAG representation of the basic block allows us to perform the following code improving
transformations:
(a) Eliminating local common subexpressions.
CO5
(b) Eliminating dead code.
(c) Restricting reordering of statements.
(d) Applying algebraic laws to reorder operands of three-address instructions.
SECTION B
1. Each question carries 10 marks.
2. Instruction: Write short/brief notes.
Q7 Translate the following expression into quadruple and triple representations:
x[ i ] = interest(p, n, r) + y[ i ]. CO3

Q8 Create a cross compiler for EQN using following compilers (i) C compiler, written in
CO1
PDP-11, producing code in PDP-11 (ii) An EQN language compiler producing code for text

formatter, TROFF and written in C. Show your steps using T-diagram.

Q9 Consider the following possible sets of LR(1) items in the states of a shift/reduce parser:

CO2
a) For the items in State 0, list any conflicts that exist and describe for what lookaheads
they occur.
b) For the items in State 1, list any conflicts that exist and describe for what lookaheads
they occur.

Q 10 Summarize the different error recovery techniques in syntax phase. CO4


Q11 Consider the following grammar: -
A → AcB | cC | C
B → bB | id
C → CaB | BbB | B
Construct the first and follow sets for the grammar. Also design a LL(1) parsing table for the grammar.

OR

Construct the operator precedence parsing table by computing leading and trailing for
every non-terminal in the following grammar: CO2

. S→N
N→V=E#
N→E
E→V
V → id
V→*E
SECTION C
1. Attempt any of the following. Each question carries 20 marks.
2. Instruction: Write long answer.
Q 12 Explain the different machine independent code optimization technique and apply those on the given

code segment and draw the optimized flow graph.


CO5
OR

(A) Generate code for the following three-address statements assuming all variables are stored
in memory locations.

1. x=1
2. x=a
3. x=a+1
4. x=a+b
5. The two statements

(i) x = b * c

(ii) y = a + x

(B) Generate code for the following sequence assuming that x, y, and z are in memory
locations:

if x < y goto L1
z=0
goto L2
L1: z = 1

You might also like