From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 0A333BB84 for ; Mon, 2 Jun 2008 11:05:00 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmQCAGVUQ0jRVcbnamdsb2JhbACSAQ0EAwYHD5U/hFs X-IronPort-AV: E=Sophos;i="4.27,577,1204498800"; d="scan'208";a="13360394" Received: from discorde.inria.fr ([192.93.2.38]) by mail3-smtp-sop.national.inria.fr with ESMTP; 02 Jun 2008 11:04:59 +0200 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id m5294sfK029476 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Mon, 2 Jun 2008 11:04:59 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmQCAGVUQ0jRVcbnamdsb2JhbACSAQ0EAwYHD5U/hFs X-IronPort-AV: E=Sophos;i="4.27,577,1204498800"; d="scan'208";a="13360393" Received: from rv-out-0506.google.com ([209.85.198.231]) by mail3-smtp-sop.national.inria.fr with ESMTP; 02 Jun 2008 11:04:58 +0200 Received: by rv-out-0506.google.com with SMTP id k40so727798rvb.57 for ; Mon, 02 Jun 2008 02:04:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=bfR4b6Zh3I8oBurublTAjvfO6oj7Rk3LOyybxjODiUM=; b=b1lFkTCmtz+NpODOxvZ/CQpG+iWLrHjEuO1VHtuDGsfHWOQH7TdWDNcueTHtEcx4i0GOUe3QMU45fTCrXnvhqJoLY0VYkm+ScqeH+EMMpqbUtYDYpLiR1+W3Du/kRUetPVCy2tILQ4uXLcMZMK4KQmkb83FWBYQmQXhHzHOAUm8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=FG7tebDSWBIOVPRF8NuaY0tgB4Qh6ustRCo0IOFMp1NWVvYZiaFlWhvaTZneG2GmQLIGLzjAwWg495DhJPgYx99FkNCW3fyuiM5cEASBW6+/3OEICUj+Dfzie6uwLQVYeI6viSgJl7QlF8cwtGf7uM41BYP4f2d0gBw5YTCarvU= Received: by 10.141.176.4 with SMTP id d4mr4792745rvp.14.1212397498599; Mon, 02 Jun 2008 02:04:58 -0700 (PDT) Received: by 10.140.193.3 with HTTP; Mon, 2 Jun 2008 02:04:58 -0700 (PDT) Message-ID: Date: Mon, 2 Jun 2008 11:04:58 +0200 From: "Berke Durak" To: caml-list@inria.fr Subject: Re: [Caml-list] picking / marshaling to strings in ocaml-revision-stable way In-Reply-To: <20080531225119.GC7463@aquarium.takhisis.invalid> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <28fa90930805302343n18b98b17t72a22ea82539fc6f@mail.gmail.com> <20080531.174314.107716495.garrigue@math.nagoya-u.ac.jp> <28fa90930805310954w3089478bqfd8c3f821fff207e@mail.gmail.com> <48418421.5090601@fischerventure.com> <20080531225119.GC7463@aquarium.takhisis.invalid> X-Miltered: at discorde with ID 4843B7B6.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; berke:01 durak:01 berke:01 durak:01 marshaling:01 zacchiroli:01 zack:01 0200,:01 escapes:01 arrays:01 booleans:01 syntax:01 syntax:01 ocaml:01 ocaml:01 On Sun, Jun 1, 2008 at 12:51 AM, Stefano Zacchiroli wrote: > On Sat, May 31, 2008 at 11:34:34PM +0200, Berke Durak wrote: >> and then output in Json format: > > Aren't you being naive about escaping needs here? > > I don't know the details of the two involved languages, but it would > mean to be very lucky if the escaping conventions are the same ... Of course, the code was intended for illustrative purposes. JSON escapes characters based using 4-digit Unicode hex codes. Except for \n, \r, etc. sot it would probably work for ASCII. Martin Jambon: > You won't obtain anything useful if you treat Atoms as JSON strings and Lists as JSON arrays because JSON has also null, numbers, booleans and objects. The real issue is that records are mapped to lists of lists, making lookup difficult and cumbersome. But that's still JSON syntax, formally... You could theoretically write a piece of code to "recognize" a record and emit a Json object but that wouldn't be very elegant. > This is the JSON standard: http://www.json.org/ I know, we are using Json (but not Json-wheel) to pass the annotated syntax tree from the C legacy front-end to the Ocaml JVM backend. However we are using Sexplib for all the internal serialization needs (mostly for debugging) since it integrates so well with Ocaml. > And that is the concrete type used to represent JSON trees in the json-wheel library (which json-static uses): That's a blessing but also a curse. You retain more information on your format, but that also complexifies anything that manipulates syntax trees. The nice thing about Sexp is that its Path module provides a small manipulation language for migrating your data. If that's not enough, you can always load it in any Scheme or Lisp and spit it back. -- Berke Durak