Вы находитесь на странице: 1из 2

A2+TA2 SLOT 23-09-2018

School of Computer Science & Engineering

Continuous Assessment Test -II


CSE2002-Theory of Computation and Compiler Design
Time: 1:30 Hrs Max.Marks:50
Answers ALL the questions
1. (a) Find an ambiguous grammar and construct LMD, RMD and Parse tree for the given string and to represent all
arithmetic expression, involving + and *, With no redundant parenthesis. ( Ex: Parenthesis is redundant in (id*id)
+id not in (id+ id) *id [4+4+2]

EE+T/T EA/M

T(T)*F/F AA+id /M+id/id/M

FE/id M(A)*id/A*id/(A)*id

EA/M/T EA/M/id

AA+T/M+T/T AA+id/M+id/id+id

M(A)*T/A*T/A*(T) M(A)*id/id*(A)/A*id/id*id/M*id

Tid/(E)

(b) Write down CNF for the given CFG :

S A | AB0 | A1A , A A0 | e , B  B1 | BC , C  CB | CA | 1B

(C) G: SAaS| ɛ , ASbB , BbCC CcD|Ec DabAA Ebc FbBC

(i) Find the number of useless symbols in the G:

(ii) Find the no. of. Production in G’ , after removal of null production such that L(G’)= L(G) - { ɛ } .

2 G: [ 15 ]

SX ↑
XA1B | 2

A2
BA

1|Pa g e
A2+TA2 SLOT 23-09-2018

For each of the the following grammar classes , if G is of that class, give the appropriate parsing
table. If it is not of that class, Fully explain(Prove) why it is not, and also parsing the i/p ↑221↑
using option d).
a) LL(0) b) LL(1) c) LR(0) d) LR(1) e) SLR(1) f) LALR(1)
3. (a) What will be the precedence and associativity of operator &, @, ↑ in the Grammar. [3+2+1]

AB ↑ A|B

BB&C|C

CD@C|D

D#-E|ɛ

E id

(b) Define Handle Pruning and Viable Prefixes

(c) The string of the form αqβ gives------- of the system where the next input is -------

4. (a) Construct Pushdown automata for L = {a(2*m)c(4*n)dnbm | m,n ≥ 0} [5+4]

(b) Construct deterministic pushdown automata to accept the binary strings that start and end with the
same symbol and have the same number of 0s as 1s.

5. (a) Consider the Turing machine : M = ({q0,q1,q2,qf}, {0,1},{0,1,B},δ, q0,B, {qf} ) [5+5]

where the elements in the 7-tuple denote the set of states, the input alphabet, the tape alphabet,
the transition function, the start state, the blank symbol, and the set of accepting states,
respectively. Suppose δ consists of the following sets of rules: δ(q0,0)=(q1,1,R);
δ(q1,1)=(q0,0,R); δ(q1,B)=(qf,B,R).

Describe the language L(M) using the notation of regular expressions.

(b) Show the ID’s of the Turing machine of the input tape contains w1= 00000010 and w2= 00100100

2|Pa g e

Вам также может понравиться