4.5 Exercises

  1. Show what happens when we give the input The wizard curses the wizard to RTN2. You should give all the steps, showing the tape and pointer, the state, and the stack, just as was done in the text.

  2. Show what happens when we give the input aab to our RTN for the language a^nb^n. This string will {\em not/ be accepted. You should give all the steps, showing the tape and pointer, the state, and the stack, just as was done in the text. Then say exactly why the string was not accepted.

  3. Consider the following context free grammar:

    S \longrightarrow a b

    S \longrightarrow a S b

    This generates the language a^nb^n \ {\epsilon}. That is, it generates the set of all the strings in a^nb^n except the empty string \epsilon. Draw the RTN that corresponds to to this grammar, and give the its Prolog representation.

  4. Write down the context free grammar that corresponds to our second RTN.


Patrick Blackburn and Kristina Striegnitz
Version 1.2.4 (20020829)