0% found this document useful (0 votes)
4 views

CD PreFinal Question Paper

Uploaded by

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

CD PreFinal Question Paper

Uploaded by

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

VIJAYA ENGINEERING COLLEGE-KHAMMAM

B. Tech III Year I Semester Pre-Final Examinations, Feb- 2024


Compiler Design
Branch-AIML

Time: 3 Hours Max. Marks: 75


Note: i) Question paper consists of Part A, Part B.
ii) Part A is compulsory, which carries 25 marks. In Part A, Answer all questions.
iii) In Part B, Answer any one question from each unit. Each question carries 10
marks and may have a, b as sub questions.
PART – A (25 Marks)
1. a) Why lexical and syntax analyzers are separated? [2]

b) List the various error recovery strategies for a lexical analysis. [3]

c) Mention the types of LR parser. [2]

d) Define LR(0) items with examples. [3]

e) What are the benefits of intermediate code generation? [2]

f) Explain about hashing. [3]

g) What is a basic block? [2]

h) Discuss about common sub expression elimination. [3]

i) How do you calculate the cost of an instruction? [2]

j) List out the common issues in the design of code generator. [3]

PART – B (50 Marks)


2.a) Explain the various phases of a compiler in detail. Also write down the output for the
following expression after each phase a: =b*cd.
b) Discuss the phases of a compiler indicating the inputs and outputs of each phase in translating
the statement “amount = principle + rate * 36.0 ” [5+5]
OR
3. a).What is FIRST and FOLLOW? Explain the steps to compute FIRST and FOLLOW with an
example. [10]
b) Define an LL(1) grammar. Is the following grammar LL(1). G:S → iEtS | iEtSes |a , E → b.
Also write the rules for computing FIRST() and FOLLOW(). [5+5]

4.a) Check whether the following grammar is SLR (1) or not. Explain your answer with
Reasons. S→ L=R S→R L→*R L→id R→L.
b)What is an LR(0) grammar?. Construct LALR parsing table for the following grammar: S→
CC, C → cC , C → c|d . [5+5]
OR
5.a) Consider the grammar. E → E + T
E→T
T→T*F
T→F
F → (E) / id
Construct CLR parsing table for the above grammar. Give the moves of the CLR parser on id *
id + id.
b) What is an LR(0) item? Construct an SLR parsing table for the grammar G: S→ L=R |R, L →
*R | id, R → L. Is it SLR(1) grammar? [5+5]

6.a) What is a three address code? . Consider the following basic block of 3-address
instructions: a:=b+c x:=a+b b:=a-d c:=b+c d=a-d y=a-d
b) Generate the three address code for the following code fragment.
a = b + 1 x = y + 3 y = a / b a = b + c [5+5]
OR
7.a) What are different intermediate code forms? [5+5]
b)Discuss different Three Address code types and implementations of Three Address
statements.

8. a) What is the role of code Optimizer in compiler? Is it a mandatory phase?


b) What is DAG and flow graph? Explain their role in compilation process? [5+5]
OR
9. Explain the following code optimization techniques with examples.
a) Constant propagation b) Strength reduction c) Code Motion [5+5]

10. Discuss about the following:


a) Copy Propagation
b) Dead code Elimination and
c) Code motion
OR
11. a) Write the code generation for the d:=(a-b)+(a-c)+(a-c).
b) Describe in detail the syntax directed translation of case statements. [5+5]

---ooOoo---

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy