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

P13CS63 - Ii

This document appears to be an exam for a Compiler Design course, as it covers various topics related to compiler construction including lexical analysis, syntax analysis, parsing, syntax directed translations, intermediate code generation, and code optimization. The exam is divided into 5 units and contains 10 questions, with students required to answer 5 questions by selecting one full question from each unit. Students are asked to describe and provide examples for various compiler concepts, techniques, and algorithms.

Uploaded by

Ral Ralte
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)
126 views

P13CS63 - Ii

This document appears to be an exam for a Compiler Design course, as it covers various topics related to compiler construction including lexical analysis, syntax analysis, parsing, syntax directed translations, intermediate code generation, and code optimization. The exam is divided into 5 units and contains 10 questions, with students required to answer 5 questions by selecting one full question from each unit. Students are asked to describe and provide examples for various compiler concepts, techniques, and algorithms.

Uploaded by

Ral Ralte
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

P13CS63 Page No...

1
U.S.N

P.E.S. College of Engineering, Mandya - 571 401


(An Autonomous Institution affiliated to VTU, Belagavi)
Sixth Semester, B.E. - Computer Science and Engineering
Semester End Examination; June - 2017
Compiler Design
Time: 3 hrs Max. Marks: 100
Note: Answer FIVE full questions, selecting ONE full question from each unit.
UNIT - I
1 a. Illustrate the translation of the statement a = b + c*60 in a compiler. 10
b. Identify Lexemes of the following code :
int max (i, j );
int i, j;
5
{
if ( i > j ) return ( i ) ;
else return ( j ) ;
}
c. Write transition diagram to recognize relational operators. 5
2 a. Explain the different compiler construction tools. 6
b. Give the block diagram of working of lexical analyzer and explain its role. 4
c. Give regular definitions to recognize unsigned numbers and also give its transition
10
diagram.
UNIT - II
3 a. What is the role of syntax analyzer? Explain the different error recovery strategies in
10
syntax analyzer.
b. Construct predictive parsing table for the following grammar :
S1 → $ #
S → qABC
A → a / bbD 10
B → a/ ∈
C → b/ ∈
D → c/ ∈
4 a. For a given grammar write algorithms to find :
10
i) First( ) ii) Follow( ) iii) Construct predictive parsing table.
b. Consider the context free grammar :
S → S ( s ) S / ∈ and the string ( ( ))
5
i) Give left most derivation for the string ii) Give right most derivation for the string
iii) Give parse tree for the string iv) Is the grammar ambiguous or unambiguous.

Contd….2
P13CS63 Page No... 2
c. Consider the following grammar :
E → E +T /T
T →T *F / F 5
F → ( E ) / id
Define left recursion and eliminate left recursion from the original grammar.
UNIT - III
5 a. Construct SLR parsing table for the following grammar :
S → CC
10
C → cC
C→d
b. Explain :
i) Handle pruning ii) Shift-reduce conflict 10
iii) Reduce-Reduce conflict iv) Shift-reduce parser.
6 a. Construct Canonical LR( ) set of items for the following grammar :
S → Aa / bAc / Bc / bBa
12
A→d
B→d
b. How error recovery is done is LR parsing? Explain with examples. 8
UNIT - IV
7 a. Write Syntax Directed Definitions (SDD) for the following grammar and hence, construct
annotated parse tree for the expression :
( 4 + 3) * ( 5 + 6 ) n
Grammar:
L → En 10
E → E +T
E →T
T →T *F
T →F
F → ( E ) / digit

b. Explain the different dynamic storage allocation techniques. 10


8 a. Briefly explain the different storage allocation strategies. 10
b. Give SDD (Syntax Directed Definitions) with inherited attributes L for the following
grammar. Using the above SDD, show annotated parse tree for the expression: 9-5+2
10
Grammar: E → E + T / E − T / T
T → ( E ) / num

Contd….3
P13CS63 Page No... 3
UNIT - V
9 a. Explain the different ways of representing 3-address code statements. Represent the
following expression in the ways 10
− ( a + b) *(c + d ) + ( a + b + c).

b. Briefly explain the different issues involved in code generation phase. 10


10 a. Construct DAG for the expression :

(( x + y ) − (( x + y ) * ( x − y ))) + (( x + y ) * ( x − y )).
5

b. Obtain 3-address code translation for the following if statement :


if ( x < 100 || x > 200 & & x! = y )
x = 10; 5
else
x = 20;
c. What is a Basic block? Given an algorithm to partition three-address instructions into
10
basic block. Also, how do you represent in DAG?

****

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