code: def repl():
      
      while True:
          try:
              sys.stdout.write("Type in next query: \n> ")
              import locale
              query_str = raw_input().decode(sys.stdin.encoding or locale.getpreferredencoding(True))
          except KeyboardInterrupt:
              break
  
          if u'quit' in query_str:
              break
  
          print_query_and_parse_tree(query_str)
docs: Read-Eval-Print-Loop for reading the query, printing it and its parse tree.
  
      Exit the loop either with an interrupt or "quit".