flac-hw6

# flac-hw6 - ” strings with more than one “ ” are...

This preview shows page 1. Sign up to view the full content.

FLAC Assignment 6 Exercise 1. Give context-free grammars that generate the following languages. In all parts the alphabet is Σ is { 0 , 1 } . a. { w | w contains at least three 1 s } b. { w | w starts and ends with the same symbol } c. { w | the length of w is odd } d. { w | the length of w is odd and its middle symbol is a 0 } e. { w | w = w R , i.e., w is a palindrome (of either odd or even length) } f. The empty set (Note: You may check your answers to parts (a) and (d) in the book; see Exercise 2.4 on page 128 and 132. But don’t peek without first trying it yourself!) Exercise 2. Give the state diagrams of pushdata automata for the following languages. d. The language of Exercise 1(d). e. The language of Exercise 1(e). f. { w # v | w has more occurrences of 1 than does v } . You may assume that the input string has no more than one occurrence of “
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: # ”; strings with more than one “ # ” are don’t-care inputs that can be ignored to simplify the design of your PDA. Exercise 3. Show the intersection of a context-free language C with a regular language R is always context-free. Exercise 4. Show that the language { n 1 m n 1 m | n ≥ } is not context-free. Exercise 5. Show that the language { ww | w ∈ ( + 1 ) * } is not context-free. Hint: Intersect with * 1 * * 1 * and use the results from Exercises 3 and 4. Exercise 6 (bonus). Is the following language context-free? Prove your answer. { ww | w ∈ ( a + b ) * , w ∈ ( a + b ) * , w 6 = w , and | w | = | w |} Page 1...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern