0% found this document useful (0 votes)
29 views2 pages

Kcs502 Compiler Design 23

This document outlines the examination paper for Compiler Design for BTECH Semester V, including instructions and sections for answering questions. It consists of multiple sections with questions covering various topics related to compiler design, such as parsing, syntax trees, and code generation. The exam is scheduled for 3 hours with a total of 100 marks.

Uploaded by

JAISHREE TIWARI
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)
29 views2 pages

Kcs502 Compiler Design 23

This document outlines the examination paper for Compiler Design for BTECH Semester V, including instructions and sections for answering questions. It consists of multiple sections with questions covering various topics related to compiler design, such as parsing, syntax trees, and code generation. The exam is scheduled for 3 hours with a total of 100 marks.

Uploaded by

JAISHREE TIWARI
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/ 2

Printed Page: 1 of 2

Subject Code: KCS502


0Roll No: 0 0 0 0 0 0 0 0 0 0 0 0 0

BTECH
(SEM V) THEORY EXAMINATION 2023-24
COMPILER DESIGN
TIME: 3 HRS M.MARKS: 100

Note: 1. Attempt all Sections. If require any missing data; then choose suitably.

SECTION A
1. Attempt all questions in brief. 2 x 10 = 20
Q no. Question Marks CO
a. Define bootstrapping in the context of compilers. 2 1
b. Which phase of compiler is optional and why? 2 1
c. Explain the concept of shift-reduce parsing. 2 2
d. Differentiate Parse tree and Syntax tree with an example. 2 2
e. Define syntax-directed translation schemes. 2 3
f. What are the two types of attributes that are associated with a grammar 2 3
symbol?
g. Discuss how scope information is represented in a symbol table. 2 4
h. What is mean by Activation record? 2 4
i. Discuss two design issues in code generation. 2 5
90

1
j. Explain the concept of global data-flow analysis. 2 5

13
_2

2.
SECTION B
P1

24
2. Attempt any three of the following: 10x3=30
a. Describe the relationship between finite state machines and regular 10 1
4D

5.
expressions. Discuss how regular expressions are used in lexical analysis
.5
P2

and pattern matching.


17
b. For the grammar 10 2
Q

|1

SaAd |bBd |aBe |bAe , Af , Bf


Construct LR(1) Parsing table. Also draw the LALR table.
5

c. Explain the concepts of quadruples and triples in the context of syntax- 10 3


3

directed translation. Discuss how they represent intermediate code and


7:

support optimization.
:2

d. Describe a simple stack allocation scheme for managing memory during 10 4


13

program execution. Explain how it is used for storing local variables and
4

managing function calls.


02

e. Explain the role of a code generator in a compiler. Discuss its 10 5


-2

responsibilities and how it translates intermediate code into the target


code.
01
4-

SECTION C
|2

3. Attempt any one part of the following: 10x1=10


a. Given a regular expression a(b|c)*, construct the corresponding 10 1
Nondeterministic Finite Automaton (NFA) that recognizes the language
described by the regular expression.
b. Check whether given grammar is ambiguous or not. If ambiguous then convert 10 1
it into unambiguous grammar: E→E+E|E*E|id.

1|Page
QP24DP1_290 | 24-01-2024 13:27:35 | 117.55.242.131
Downloaded from: uptukhabar.net
Printed Page: 2 of 2
Subject Code: KCS502
0Roll No: 0 0 0 0 0 0 0 0 0 0 0 0 0

BTECH
(SEM V) THEORY EXAMINATION 2023-24
COMPILER DESIGN
TIME: 3 HRS M.MARKS: 100

4. Attempt any one part of the following: 10x1=10


a. Check whether the given grammar is LR(0) or not: S→PQy, P→Sy|x, Q→yS. 10 2
b. Consider the following grammar for a simple expression language: 10 2
E→E+T|T
T→T*F|F
F → ( E ) | id
Consider expression id * (id+id).Apply shift reduce parsing to construct parse
tree.

5. Attempt any one part of the following: 10x1=10


a. Write syntax directed definition for a given assignment statement: 10 3
S → id=E
E → E+E
E →E*E
E→-E
90
E → (E)

1
13
E→id
_2

b. Explain how syntax-directed translation handles array references within 10 3

2.
P1

arithmetic expressions.

24
4D

5.
6. Attempt any one part of the following: 10x1=10
.5
P2

a. Define Symbol table? Explain about the data structures used for symbol 10 4
17
table.
Q

b. Define semantic errors in a compiler. Discuss the challenges associated 10


|1

with detecting and handling semantic errors. Provide examples to


5

illustrate semantic issues.


3
7:

7. Attempt any one part of the following: 10x1=10


:2

a. Consider a basic block with the following three instructions: 10 5


13

1. x = a + b
2. y = x * c
4
02

3. z = y – d
Apply common sub expression elimination to optimize the basic block.
-2

b. Construct a Directed Acyclic Graph (DAG) to represent the following 10 5


01

basic block:
4-

1. x = a + b
|2

2. y = c - d
3. z = x * y

2|Page
QP24DP1_290 | 24-01-2024 13:27:35 | 117.55.242.131
Downloaded from: uptukhabar.net

You might also like