caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [ANN] Atdgen/Biniou with support for cyclic values
@ 2010-12-20 12:47 Martin Jambon
  2010-12-20 12:59 ` [Caml-list] " Микола Стрєбков
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Jambon @ 2010-12-20 12:47 UTC (permalink / raw)
  To: OCaml Mailing List

Hi list,

Atdgen is a tool that produces OCaml serializers and deserializers from
type definitions in the ATD syntax.  Two serialization formats are
supported:  JSON and Biniou.  For more information on the project, see

  http://martin.jambon.free.fr/atd-biniou-intro.html

The main highlight of this release (1.1.0) is support for sharing, which
allows the serialization of cyclic values such as graphs.  Sharing is
currently supported for the Biniou format only and requires extra
wrapping using type ref for non-record types.

The other new features are listed here:

  http://oss.wink.com/atdgen/atdgen-1.1.0/Changes.txt


Example:

$ cat cycle.atd
type shared_node = node shared (* sharing point *)

type node = {
  label : string;
  self : shared_node;
}

$ cat test_cycle.ml
open Cycle

let () =
  let rec a = { label = "A"; self = a } in
  let s = string_of_shared_node a in
  Printf.printf "%i %S\n" (String.length s) s;
  let a' = shared_node_of_string s in
  assert (a != a');
  assert (a == a.self);
  assert (a' == a'.self);
  print_endline "Success"

$ atdgen cycle.atd
$ ocamlfind opt -o test_cycle \
    graph.mli graph.ml test_cycle.ml \
    -package atdgen -linkpkg
$ ./test_cycle
17 "\026\000\021\002\239\175\r\244\018\001A\204P\139\140\026\015"
Success


Dissection of the serialized value:

  \026 shared_tag
  \000 0 indicates that the value follows

  \021 record_tag
  \002 field count
    \239\175\r\244 hash("label")
      \018 string_tag
      \001 string length
      A    string contents
    \204P\139\140 hash("self")
      \026 shared_tag
      \015 find value 15 bytes backward

The Biniou format is fully described here:

  http://martin.jambon.free.fr/biniou-format.txt



Home of each project:

  http://martin.jambon.free.fr/biniou.html
  http://martin.jambon.free.fr/yojson.html
  http://oss.wink.com/atd/
  http://oss.wink.com/atdgen/


Non-interactive installation with Godi:

$ godi_console update
$ godi_console perform -build godi-atdgen


Each of these four projects are distributed under a BSD license.

Biniou (c) 2010 Martin Jambon
Yojson (c) 2010 Martin Jambon
Atd (c) 2010 MyLife
Atdgen (c) 2010 MyLife




Enjoy.



Martin


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] [ANN] Atdgen/Biniou with support for cyclic values
  2010-12-20 12:47 [ANN] Atdgen/Biniou with support for cyclic values Martin Jambon
@ 2010-12-20 12:59 ` Микола Стрєбков
  0 siblings, 0 replies; 2+ messages in thread
From: Микола Стрєбков @ 2010-12-20 12:59 UTC (permalink / raw)
  To: Martin Jambon; +Cc: OCaml Mailing List

Hi,

On 20 груд. 2010, at 14:47, Martin Jambon wrote:

> Atdgen is a tool that produces OCaml serializers and deserializers from
> type definitions in the ATD syntax.  Two serialization formats are
> supported:  JSON and Biniou.  For more information on the project, see
> 
>  http://martin.jambon.free.fr/atd-biniou-intro.html
> 
> The main highlight of this release (1.1.0) is support for sharing, which
> allows the serialization of cyclic values such as graphs.  Sharing is
> currently supported for the Biniou format only and requires extra
> wrapping using type ref for non-record types.
> 
> The other new features are listed here:
> 
>  http://oss.wink.com/atdgen/atdgen-1.1.0/Changes.txt

I'm using it for some time already and it works for me.
Thanks, Martin :-)

-- 
Mykola Stryebkov
Public key: http://mykola.org/pubkey.txt
fpr: 0226 54EE C1FF 8636 36EF  2AC9 BCE9 CFC7 9CF4 6747


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-12-20 12:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-20 12:47 [ANN] Atdgen/Biniou with support for cyclic values Martin Jambon
2010-12-20 12:59 ` [Caml-list] " Микола Стрєбков

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).