Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions