anchor.diff:  module TcErr = FStar.TypeChecker.Err
   module TcEnv = FStar.TypeChecker.Env
   module CTable = FStar.Interactive.CompletionTable
  -
  -exception ExitREPL of int
   
   (** Checkpoint the current (typechecking and desugaring) environment **)
   let push env msg =
  
positive.code:   Util.print_raw (Util.string_of_json json);
    Util.print_raw "\n"
  
  let write_response qid status response =
    let qid = JsonStr qid in
    let status = match status with
                 | QueryOK -> JsonStr "success"
                 | QueryNOK -> JsonStr "failure"
                 | QueryViolatesProtocol -> JsonStr "protocol-violation" in
    write_json (JsonAssoc [("kind", JsonStr "response");
                           ("query-id", qid);
                           ("status", status);
                           ("response", response)])
  
  let write_message level contents =
    write_json (JsonAssoc [("kind", JsonStr "message");
                           ("level", JsonStr level);
                           ("contents", contents)])
  
  let write_hello () =
    let js_version = JsonInt interactive_protocol_vernum in
    let js_features = JsonList (List.map JsonStr interactive_protocol_features) in
    write_json (JsonAssoc (("kind", JsonStr "protocol-info") :: alist_of_protocol_info))
  
  (*****************)
  (* Options cache *)
  
negative.code:   | UnexpectedJsonType (expected, got) -> wrap_js_failure qid expected got
  
  let read_interactive_query stream : query =
    match Util.read_line stream with
    | None -> exit 0
    | Some line ->
      match Util.json_of_string line with
      | None -> { qid = "?"; qq = ProtocolViolation "Json parsing failed." }
      | Some request -> safe_unpack_interactive_query request
  
  let safe_unpack_interactive_query js_query =
    try
      unpack_interactive_query js_query
    with
    | InvalidQuery msg -> { qid = "?"; qq = ProtocolViolation msg }
    | UnexpectedJsonType (expected, got) -> wrap_js_failure "?" expected got
  