Reference no: EM133019012
There are 5 questions for credit and one for you to ponder.
Question 1: Consider the grammar
S → aS|aSbS|ε.
Show that this grammar is ambiguous by giving two different parse trees for the string aab.
Question 2: Show that the grammar of the last question defines all strings, and only those strings, in which every prefix contains at least as many as as bs. Note that this requires two proofs. First, you must show that every string produced by the grammar has this property. Second, you must show that every string that has this property can be produced by this grammar.
Question 3: Give an unambiguous grammar for the language defined by the grammar in question 1.
Question 4: Give an unambiguous context-free grammar to define the following language:
L = {ai+jbj+kci+k|i,j,k ≥ 1.}
Question 5 Construct a PDA that accepts the following language
{a3ibi| ≥ 0}.
Your answer should be a drawing of the states and transitions.
Question 6 Show that the language L = {anbn|n ≥ 0} U {anb2n|n ≥ 1} is context free, but is not accepted by any deterministic PDA.