Sketch of Solutions to Exercises

3.1.1 (a)
                if eof then accept 
    out := c 
    read x 
    if x!=a then reject 
    write out 
    call RP() 
    if eof then accept 
    procedure RP() 
      read x 
      if x=b then return 
      write out 
      call RP() 
      read x 
      if x!=b then reject 
      return 
    end 

(b)

           if eof then accept 
    read x 
    write x 
    call RP() 
    if eof then accept 
    procedure RP() 
      do 
        read x 
        write x 
        call RP() 
      or 
        read y 
        return 
      until true 
      read y 
      return 
    end 

(c)

    call RP() 
    if eof then accept 
    procedure RP() 
      do 
        read u 
        call RP() 
      or 
        read disc 
        do 
          read x 
          y := ? 
          write y 
        or 
          y := ? 
          if y=disc then reject 
          write y 
          return 
        until true 
      until true 
      read v 
      write v 
      return 
    end