Comp Theory

1. Consider the grammar G: S → a S b S | b S a S | ε Describe in English the language generated by G. Prove that G generates precisely this language. Is the language generated by G regular? Prove your answer. Show that G is ambiguous. 2. Put the grammar G in question (1) into Chomsky Normal Form. Use the Cocke-Younger-Kasami algorithm to parse the sentence abab according to your CNF grammar. Display the CYK table constructed by the CYK algorithm and show how all parse trees for this sentence can be reconstructed from the CYK table. 3. From the grammar G in question (1), construct a pushdown automaton that accepts L(G) by empty stack. Show all sequences of moves that your PDA can make to accept the input string abab. 4. From your PDA in question (3), construct an equivalent context-free grammar. Show all the parse trees for the input string abab according to your grammar. 5. If L is a language, let max(L) = { w | w is in L but for no nonempty x is wx in L }; that is, if w is in L, then there is no continuation of w that is in L. If L’ is the context-free language { apbqcr | p ≥ r or q ≥ r }, what is max(L’)? Use the pumping lemma for CFLs to show that max(L’) is not context free.

Place Similar Order Now!

  • Our Support Staff are online 24/7
  • Our Writers are available 24/7
  • Most Urgent order is delivered with 6 Hrs
  • 100% Original Assignment Plagiarism report can be sent to you upon request.