Jl'Li: Jyffl)

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

2·2023ilOl9

CS/B.TECH(N)/OOO/SEM•5/5506/202
MAULA�A. A,BUL � A�A� AZAD UNIVERSITY.OF TECHNOLOGY, WEST BENGAL
� R1po� Code : PCG-CS501 Complier Design

Time Allott ed : 3 H_ours Full Marks :70


The Figures In ths margin lndlcals full marks.
Candidats 8/f! required to give their answers in their own words as far as praclicaole

• Group-A (Very snort Answer Type Question)

1. ·Answer any:te,;i of the.following: ( 1 x 10 • 10 J


.
(Q If all !lie operators are binary, the,:, � string of operands and operators is a postfix expression if and only ii ___
(II) • Given a gram,:nar G..(v, T, P, Sj' and every production In p is of the form A->a where A is in V and a is in (V U T)''
then G
Is____
.1)11( A compiler running on computes with a small memory would normally be
Jl'li
£
Input to LEX is
A basic block is
(Vl ) Given a.finite automaton M-(O,l:. 6 , q0, F). II 6 maps a � .t to 2 Q, then_
fP(' Given a string abc , the siting ace ls· a _____
JYffl) A garbage is ____

om
;w:f How many descriptors are used for track both the registers (lor availability) and addresses (location o l values) while
generating the code?
J,Xl A synthesized attribute is an anrlbute whose value at a parse tree node Is defined in terms ol ____
IK1> Ellminatio11 of loop Invariant computation is a peephole opIimizaIion . True/False?
�•
.4
t.c
111 _____ is a loop optimization

Group-B (Short Answw,r Type Question)


bu

Answer any three of the following ( 5x3-1s1

2. Describe input buffer ing In lexical analyser. I5I


;Y. Explain the model of a non recursive predicIive parser with a diagram. I 51
yw

4. Find the output, given grammar Gl and associaled semantic rvles and input: aadbd Isl
• S·>AS (priot(1 )}
• S->AB {pri,:it(2))
• A•>a {prinl(3))
m

• B-;,b C (plint(4))
• 8->d 8 (prinl(S))
• C·>C (prin1(6))
)i. What is ambiguity? Show that G2:(S•>aSjSala) is ambiguous [ 5)
p. What is code optimization? Optimize lhe following C-code; 1sI
count..o;
result= 0;
while(counl++ < 20)
I
increment• 2"count;
result .... increment;
}

Group-C (Long Answer Type Question)


Answer any three of the following
[ 15 X 3 •. 45 j

:?
For the lollowlng grammar I 3+S.s.+2 I
[ E-> E orT_Fr
T->T and F!F
F·> not-Fl(E)I 011
,afElimlnate left recursion from the above grammar
-� Find FIRST(X),Follow(X) for each varlable In the grammar
c) Construct a predictive parser table for the grammar
d) ls the above grammar LL(1 ). Justify your answer
/4 � What is a compiler?
• 2+10+3 J

b) Explain the different phases ol compiler with an-example


c) Compare and contrast between a compiler and an interpreter ( 9+6]
/ i) Express the expression yz(a+b)'c In
a.)poslfix notation
)>:) Abstract syntax tree
,c). Three address code
ii) Implement the TAC using
A. quadruples
� - triples c-
,-fndirect triples : 3+6+3+3]
y
16. Consider the regu·lar expression (a+.bra(a+b)(a+b)
regular express,·on
I. Augment the expression and construct the syntax tree lo< the above
tree
II. Find Firstpos0 and �stpOs0 for every internal node in the syntaX

om
Ill. Find Followpos0 lor every position in the syntax tree
Followpos()
IV. Construct the corresponding DFA for the given RE using
1 l:/9 ) What is LEX?
b) Explain the working of LEX . . tokens
w the step by step cons truct ion of a lexic al analyzer with the following three
c) Sho
t.c
•a
• abb
• a'b+
bu

... END OF PAPER •••


yw
m

2;2

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