Question: Lecture: CFL - PDA 1 . ( 2 0 points ) Give context - free grammars that generate the following languages. In all parts, the

Lecture: CFL-PDA
1.(20 points)
Give context-free grammars that generate the following languages. In all parts, the alphabet \Sigma is {0,1}.
a.{w| w starts and ends with the same symbol}
b.{w| w = wR, that is, w is a palindrome}
Lecture: CFL-PDA
2.(20 points)
Give a context-free grammar that generates the language
A ={aibjck| i = j or j = k where i, j, k >=0}.
Is your grammar ambiguous? Why or why not? (if yes, please draw the parse trees.)
Lecture: CFL-PDA
3.(20 points)
Convert the following CFG into an equivalent CFG in Chomsky normal form, using the procedure given in Theorem 2.9.
A -> BAB | B |\epsi
B ->00|\epsi
Lecture: CFL-PDA
4.(20 points)
Show that if G is a CFG in Chomsky normal form, then for any string w in L(G) of length n >=1, exactly 2n 1 steps are required for any derivation of w.
Lecture: non-CFL
5.(20 points)
Let \Sigma ={1,2,3,4} and C ={w in \Sigma | in w, the number of 1s equals the number of 2s, and the number of 3s equals the number of 4s}. Show that C is not context free.
Please make sure to choose an appropriate string S in your proof.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!