B.tech. Computer COT-404 2012

You might also like

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

Sheet No.

NATIONAL IIIISTITUTE OF TECHNOLOGY, KURUKSHETRA THEORY EXAMINATION Question Paper

Month and Year of the Examination: MAY/JUNE 2O12 Programme : B.Tech Semester: 8th

Subject.

...COMPILER DESIGN...

Course No............COT-

4O4..

Maximum Marks......S0......
..

Number of Questions to be attempted...5.... Time allowed.........3 HRS.... Total No. of Questions.. . . .. ......7 . Total No. of Pages used...2....
Assume suitably and state, additional data required, if any.

The Candidates, before starting to write the solutions, should please check the question Paper for any

discrepancy, and also ensure that have been delivered the question paper of right course ao. and right subject title.

I 2 3 4 5

I Give

Structure of Compiler and explain the output different phases of compiler for the following,ptatement: While A<= 2* B 1 5 &A < B doA = A* B* C

(10)

| Construct a LL (1) parsing table for the following grammar wi:ere S is the starting symbol.

S-+aRDh B---+cC
grarnmar:

: ::e. C-+bCl D-+EF E--+gl F---,flS


Table for the
e

I (10)

| Construct canonical LR Parsing


S -+ aSbS |

following

I ttOt

I bSaS I

construct LALR Parsing Table for the following grammar: S ---+ CC C-+ cC ld

ttot

parse tree translations and stack implementation for the I ttOt | Give calculator I expression (74*42+91*23 implementation.

using a desk

NATIOIYAL INSTITUTE OF TBCIINOI,OGY, KURI'I(STIEIRA


6(a)

Explain the data structufe'used for symbol table with their complexities.
Write three address code for the following statement: While (a.b) do if (cid) then x= y+z else x = y-z

(5)

(b)

(s)

7
d1

(10)

a:2
b= I

d2

d3: c =a+2

a:

.,:

d4:'d=ofb
d9: e = e*c
d5: l=c*1

..)
:

i ii
lr:

.i!

.i

d6: e=c*d

:::

.;

d7:,d= et2 d8:,b=d+e,

-:.

i;l

-t

You might also like