Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

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

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

P15CS63 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; May/June - 2018
Compiler Design
Time: 3 hrs Max. Marks: 100
Note: Answer FIVE full questions, selecting ONE full question from each unit.
UNIT - I
1 a. With a neat diagram, explain the phases of a compiler. Show the translation made by each of
12
the phases for the statement a = b + c * 10 where a, b and c are real.
b. Explain the input buffering strategy used in lexical analysis phase. 8
2 a. With neat diagram, explain the role of lexical analyzer. 6
b. Define the term Token, Pattern and Lexeme. Find the same for the following program
fragment : 8
printf(“Total = %d\n average = %f \n”, score, area);
c. Define regular expression and write transition diagram to recognize the tokens given below :
6
i) Identifier ii) Unsigned number
UNIT - II
3 a. Define Left Recession and Left Factoring. Give the algorithm used for eliminating Left
8
Recursion.
b. Construct the predictive parsing table for the given grammar and show the parsing steps for
the string “uvuvx2”
S → uB2 12
B → Bv | vuE| vxuE | ByE
E → v | vx
4 a. Briefly explain the problem associated with Top Down Parsing. 6
b. Explain Non-recessive Predictive Parsing algorithm. 6
c. Compute First( ) and Follow( ) symbols for the following grammar and check whether
grammar is LL(1) :
S → iEtSS′|a 8
S′ → eS|ε
E→b
UNIT - III
5 a. Explain the working of shift reduce parser and also conflicts that may arise during shift
6
reduce parsing with an example.
b. Write LR parsing algorithm. 6

Contd…2
P15CS63 Page No... 2
c. Construct LR(0) item for given grammar : A → (A) | a 8
6 a. Write the algorithm for constructing set of LR(1) items. 8
b. Construct LALR parsing table for the following grammar :
S → CC 12
C → cC | d
UNIT - IV
7 a. Define the following terms with an example :
i) Syntax directed definition
ii) Inherited attribute 10
iii) Synthesized attribute
iv) Annotated parse tree
b. Give the syntax directed definition to process a simple variable declaration in C and draw
10
dependency graph for int id1, id2, id3.
8 a. Explain in detail different dynamic storage allocation strategies. 10
b. Describe an activation record. Explain the purpose of each item in an activation record with
10
an example.
UNIT - V
9 a. What is DAG? Write DAG for the expression :
4
((x+y) – ((x+y) * (x – y))) + ((x+y) * (x – y).
b. Name the different types of representation of 3-address code and translate the given
arithmetic expression into each type. 6
a–b*c+d–a+b
c. Describe the method of generating intermediate code for the branching statement (if/if-else). 10
10 a. Briefly explain main issues in code generation. 10
b. Explain the code generation algorithm and generate code for the following expression :
10
x = (a - b) + (a + c).

****

You might also like