cse-7-sem-language-processor-2015

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

NTK/KW/15/7575

Faculty of Engineering & Technology


Seventh Semester B.E. (C.S.E.) (C.B.S.) Examination
LANGUAGE PROCESSOR

Time—Three Hours] [Maximum Marks—80


INSTRUCTIONS TO CANDIDATES

(1) All questions carry marks as indicated.

(2) Solve Question No. 1 OR Question No. 2.

(3) Solve Question No. 3 OR Question No. 4.

(4) Solve Question No. 5 OR Question No. 6.

(5) Solve Question No. 7 OR Question No. 8.

(6) Solve Question No. 9 OR Question No. 10.

(7) Solve Question No. 11 OR Question No. 12.

(8) Due credit will be given to neatness and adequate


dimensions.

(9) Assume suitable data wherever necessary.

(10) Illustrate your answers wherever necessary with the


help of neat sketches.

MVM—47659 1 Contd.
www.rtmnuonline.com

10. (a) What is dominator ? Construct dominator tree for 4. (a) What is Augmented grammar ? Why there is a need
the following graph. Also detect Back edges from to have Augmented Grammar while constructing LR
the given graph. 7 parsers ? Explain with suitable example. 4
1
(b) Construct LR(1) Parsing Table for the given grammar.
2 S → AaAb
3
S → BbBa

4 A→ ∈

B → ∈. 9
5 6
5. (a) Write SDTS to generate TAC for the given Boolean
7 Expression :

NOT (T > U AND A < B OR C > D). 8


8
(b) Consider the SDTS :

E → E + E {Print "+"}
9 10
E → E * E {Print "*"}

E → id [Print id.name}
(b) Write short note on Loop Unrolling and Loop Jamming.
6 Convert infix id + id * id into postfix. 5

OR

MVM—47659 6 Contd. MVM—47659 3 Contd.

www.rtmnuonline.com
www.rtmnuonline.com

6. Generate three address code using SDTS for following : 9. Compute IN and OUT equations for following graph.
13
A[I, J, K] = B[I, J] + C [I + J + K]
(1) I = 2
where
B1 (2) J = J + 1
A is 3D array of size 10 × 10 × 10

B is 2D array of size 10 × 10
B2
(3) I = 1
C is 1D array of size 30

bpw = 2

Draw Annoted Parse tree for the same. 13 B3 (4) J = J + 1

7. (a) What is Symbol Table ? Explain various data structures


B4
required to implement symbol table. 9
(5) J = J – 4
(b) Explain Activation record for procedure calls. 5

OR B5

8. (a) What are the different types of errors ? Explain various


error recovery strategies used by compiler. 9

(b) Write short note on Run-Time support as provided


by compiler. 5 OR

MVM—47659 4 Contd. MVM—47659 5 Contd.

www.rtmnuonline.com
www.rtmnuonline.com

1. (a) Explain various phases of compiler in detail. 8 11. (a) Apply Heuristic ordering algorithm to detect optimal
(b) Write short note on implementation of Lexical Analysis. sequence and then generate optimal code for that
Also explain structure of LEX. 6 sequence using two registers R0 and R1 for the
following code :
OR
T1 = a + b
2. (a) Write a LEX program to recognize keyword if/then T2 = c + d
else; identifier; constant. 6 T3 = e – T2
T4 = T1 – T3 . 9
(b) State the difference between pass and phase of
compiler. 4 (b) Explain different design issues for a good code
generator. 4
(c) What is cross compiler ? Explain how boot-strapping OR
is used in design of a compiler. 4
12. (a) Give labelling algorithm and determine number of
3. (a) Explain why we remove left recursion and perform registers required to evaluate following instruction
left factorization for the given CFG while constructing set:
LL(1) parser. 4 T1 = a + b
T2 = c + d
(b) Construct LL(1) parsing table for the given grammar.
T3 = e + f
A → aCDq | aBg | ∈
T4 = T2 + T3
C → p | ∈ | Ct | BD | rAB T5 = T4 + T1 . 6

D→d| ∈ (b) Write a short note on Peephole Optimization. 7

B → e | ∈. 9

OR

MVM—47659 2 Contd. MVM—47659 7 3050

www.rtmnuonline.com

You might also like