advertisement

Name: ______________________________ COT 3210 Exam 2. Answer all questions. Each question worth 10 points. 1. Use the pumping lemma to prove that 0n1m, n m, is not regular. 2. Prove that L = 0nww0n , n > 0, not regular, where w is a string. 3. Give a context-free grammar to generate the language 0n1m, n m. 4. Give a context-free grammar to generate the language (0+1)0*(11)+. For the next two questions, consider the CFG (S is the start symbol): S -> SA | a A -> Aa | aB B -> bB | SB | b 5. Show how to derive the string aabab using this CFG using a left-most derivation. 6. Show a parse tree for the string aabb 7. Describe (at a very high level) a PDA to accept sets of “balanced” “{“ and “ }” symbols from a “C” program. That is, the alphabet consists of the two symbols: “{“ and “}” Strings are sequences of these symbols such that no prefix of the string has more “}” than “{“. For example, the following is legal: {{}{}}, but the following string is not: {}}{. 8. Suppose we have a finite automata with TWO stacks (instead of just one stack as with a PDA). Describe at a very high level how we can accept 0n1n2n using this type of machine.