Jawaharlal Nehru Technological University Hyderabad

Jawaharlal Nehru Technological University Hyderabad B.Tech III COMPILER DESIGN Previous Question Paper (May/June - 2019 - R13)

B.Tech | III | I | R13 | May/June - 2019

Answer PaperPaper Code: 115APMaximum Marks: 75Time: 3 hours

Note: This question paper contains two parts A and B. Part A is compulsory which carries 25 marks. Part B consists of 5 Units. Answer any one full question from each unit. Each question carries 10 marks and may have a, b, c as sub questions.

Part A

125 marks
a

Why lexical and syntax analyzers are separated?

2 marks

Answer

Separation simplifies compiler design by modularizing the process. Lexical analysis handles character stream processing and tokenization, which is easier to implement using regular expressions, while syntax analysis focuses on the hierarchical structure using context-free grammars. This separation improves compiler efficiency, maintainability, and portability.

b

List the various error recovery strategies for a lexical analysis.

3 marks

Answer

Common error recovery strategies include: 1) Panic mode recovery (deleting successive characters until a valid token is found), 2) Local correction (inserting, deleting, or replacing a character), and 3) Global correction (minimizing the number of changes to transform the input into a valid sequence).

c

Mention the types of LR parser.

2 marks

Answer

Sign in to view the complete answer paper.

d

Define LR(0) items with examples.

3 marks

Answer

Sign in to view the complete answer paper.

e

What are the benefits of intermediate code generation?

2 marks

Answer

Sign in to view the complete answer paper.

f

Explain about hashing.

3 marks

Answer

Sign in to view the complete answer paper.

g

What is a basic block?

2 marks

Answer

Sign in to view the complete answer paper.

h

Discuss about common sub expression elimination.

3 marks

Answer

Sign in to view the complete answer paper.

i

How do you calculate the cost of an instruction?

2 marks

Answer

Sign in to view the complete answer paper.

j

List out the common issues in the design of code generator.

3 marks

Answer

Sign in to view the complete answer paper.

Part B

2

Explain the various phases of a compiler in detail. Also write down the output for the following expression after each phase a:=b*c+d.

10 marks

Answer

Sign in to view the complete answer paper.

OR
3

What is FIRST and FOLLOW? Explain the steps to compute FIRST and FOLLOW with an example.

10 marks

Answer

Sign in to view the complete answer paper.

4

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.

10 marks

Answer

Sign in to view the complete answer paper.

OR
5

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.

10 marks

Answer

Sign in to view the complete answer paper.

6

What is a three address code? Mention its types. How would you implement the three address statements? Explain with examples.

10 marks

Answer

Sign in to view the complete answer paper.

OR
7

Describe in detail the syntax directed translation of case statements.

10 marks

Answer

Sign in to view the complete answer paper.

8

What are steps needed to compute the next use information?

10 marks

Answer

Sign in to view the complete answer paper.

OR
9

Discuss about the following: a) Copy Propagation b) Dead code Elimination and c) Code motion.

10 marks

Answer

Sign in to view the complete answer paper.

10

Write the code generation for the d:=(a-b)+(a-c)+(a-c).

10 marks

Answer

Sign in to view the complete answer paper.

OR
11

Write a code generation algorithm. Explain about the descriptor and function getreg(). Give an example.

10 marks

Answer

Sign in to view the complete answer paper.

About this paper

This page contains the question paper of COMPILER DESIGN from Jawaharlal Nehru Technological University Hyderabad for B.Tech CSE III I, May/June - 2019, R13.

For the solved question paper with answers, switch to the Answer Paper tab.

Other papers in COMPILER DESIGN

Loading Question Papers

Fetching data from database...