Toc 3
Toc 3
1. S0S1/SS/ ϵ W= 0011
3. SSbS/a W=abababa
4. SaSb/ab W=aaabbb
5. RR+R/RR/R*/a/b/c W=a+b*C
(b) EE+T E T T(E) T i How many variables does the above grammar have when converted
to CNF?
(c) The __________ running time of CYK is O(n3 .|G|) where n is the length of the parse string and |G| is
the size of the context free grammar G
2. G: [ 3+4+5+3 ]
SX a↑
XYb|YZc
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 ↑abbc↑
using option c).
1|Pa g e
A1+TA1 SLOT 23-09-2018
S→(L)|a
L→L,S|S
Construct the operator precedence parser and operator precedence functions. Then parse the following
string: ( a , ( ( a , a ) ,(a , a) ,a ) )
n s s 2n
4 (a) Construct Pushdown automata for L = {a a d(ba) c ∈ {a, b, c, d} ∗ | n, s ≥ 0}.Show that
whether the PDA accepts the word aaadbabacc ?
(b) Find the language L(M) for the given PDA transition diagram. [5+3]
5. (a) Construct a TM that accepts all strings of Palindrome over the alphabet {a,b}. Given the input strings, abba
and ababa, discuss the ID (instantaneous descriptions) of the TM. Explain the logic that how the Turing machine
works and give the corresponding transition rules.
(b) Construct an unrestricted grammar (G: SACaB CaaaC CBDB CBE aDDa ADAC aEEa
i
2
AE ϵ ) to accept { 0 | i≥1 } [5+4]
2|Pa g e