Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
38 views3 pages

CST302 Compiler Design, June 2023

This document is an examination paper for the B.Tech Degree in Compiler Design from APJ Abdul Kalam Technological University, with a maximum score of 100 and a duration of 3 hours. It consists of two parts: Part A contains short answer questions, while Part B requires detailed answers to full questions from various modules covering topics like compiler phases, parsing techniques, and code optimization. The exam includes questions on theoretical concepts as well as practical applications in compiler design.

Uploaded by

botghost44
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)
38 views3 pages

CST302 Compiler Design, June 2023

This document is an examination paper for the B.Tech Degree in Compiler Design from APJ Abdul Kalam Technological University, with a maximum score of 100 and a duration of 3 hours. It consists of two parts: Part A contains short answer questions, while Part B requires detailed answers to full questions from various modules covering topics like compiler phases, parsing techniques, and code optimization. The exam includes questions on theoretical concepts as well as practical applications in compiler design.

Uploaded by

botghost44
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/ 3

A

r200csT3020s2302

Reg No.: Name:

APJ ABDUL KALAM TECHNOLOGICAL UNIVERSITY


B.Tech Degree 56 (R, S) / 56 (PT) (R) Examination June 2023 (2019

Course Code: CST302

Course Name: COMPILER DESIGN


Max. Marks: 100 Duration:3 Hours

PART A
Answer all qaestions, each carries 3 marks. Marks

I What is the relevance of input buffering in lexical analysis? (3)


2 Draw a transition diagram to represent relational operators. (3)
3 With an example write the steps to remove left recursion. (3)
4 What is left factoring? Left factor the following grammar, C (3)

E+E+TlT
T -+ float l float. T l (E)
5 Differentiate CLR and LALR parsers. (3)
6 parser?
What are the possible actions of a shift-reduce (3)
7 Convertthe expression a=b * -c+b * -c intoquadruple? (3)
8 Define SDD with an example. (3)
9 Explain common sub expression elimination with an example. (3)
t
I0 How the peephole optimization technique makes its role in the compilation (3)
Process?
PART B
nsuter onefull questionfrom each module, each carries 14 marks,
Module l.;
I I a) What are the various phases of a compiler? Explain each phase in detail by using (8)
the input statement. position := initial * rate * 60
b) Differentiate tokens, patterns and lexemes with the help of an example. (6)
OR
12 a) Write short notes on compiler construction tools. (6)
b) Explain in detail about buffer pairs and sentinels. (8)

Page lof3
1200csT302052302

Module ll
13 a) Find FIRST set and FOLLOW set of each nonterminal in the following (6)
grammar.

S -r aBDh I bBc
B+eC
C+bCle
D-rEF
E-'gle
P+fle
b) Explain the error rccovery strategies in parsing. (8)
OR
14 a) i) Show that the given grammar is ambiguous or not. (7)
E+E+ElE-E
E+E*ElE/E
E+E^E
E + (E) lid

Also eliminate ambiguity from the above grammar.


(Precedence order: id, ( ), ^, * and /, + and -)

b) Construct a non-recursive predictive parsing table for the following grammar: (7)
S+(L)la
[,+L,SlS
Also prove that the grammar is LL(l) or not.
Module lll
15 a) What is a shift-reduce parser? Explain in detail the conflicts that may occur (8)
during shift-reduce parsing. - .-; I

b) Construct canonical LR(l) collection of items for the grammar below: (6)
S+CC
C+aC
C+d
OR

16 Consider the grammar (14)


S+AalbAcldclbda
A-d

Page 2of3
1200csr3020s2302

Construct a LALR parsing tahle for the grammar given above. Veriff whether
the input string "bdc" is accepted by the grammar or not.
Module lV
17 a) Define the following terms and give suitable example for each. (6)
i) Three-address code ii) Triples iii) Quadruples.
- b) Explain static allocation and heap allocation strategies. (8)

OR

18 a) Construct a syntax directed definition for an assignment statement. (7)


S->E
E->El +82
E->El *82
E->-El
E -> (El)
E->id
Also construct an annotated parse tree for the input string: 6 * 8 + 5.
b) Generate an intermediate code for the following code segment along with the (7)
required syntax-directed translation scheme.
if(a>b)
x:a*b
else
t *:a-b
where a and x are of real and b of int type data.
Module V
19, a) Explain different code optimization techniques. .gl
b) Generateacodesequencefortheassignmint{ = (a-b) + (a-c) + (a-c). (6)

OR

20 a) Explain the design issues of a code generator. (7)


b) Illustrate the optimization of basic blocks with examples. (7)
****

Page 3of3

You might also like