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=3.4 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE, DNS_FROM_SECURITYSAGE,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 8CB54BBAF for ; Sat, 25 Oct 2008 21:19:12 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjwEAMcNA0nVBJXyY2dsb2JhbACBdZF7FwkKCBAFrCuDTw X-IronPort-AV: E=Sophos;i="4.33,484,1220220000"; d="scan'208";a="30748613" Received: from concorde.inria.fr ([192.93.2.39]) by mail4-smtp-sop.national.inria.fr with ESMTP; 25 Oct 2008 21:19:12 +0200 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m9PJJBOW020309 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Sat, 25 Oct 2008 21:19:12 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjwEAMcNA0nVBJXyY2dsb2JhbACBdZF7FwkKCBAFrCuDTw X-IronPort-AV: E=Sophos;i="4.33,484,1220220000"; d="scan'208";a="30748612" Received: from outmailhost.telefonica.net (HELO ctsmtpout2.frontal.correo) ([213.4.149.242]) by mail4-smtp-sop.national.inria.fr with ESMTP; 25 Oct 2008 21:19:11 +0200 Received: from NANA.localdomain (83.59.9.219) by ctsmtpout2.frontal.correo (7.2.056.6) (authenticated as ferferse$telefonica.net) id 4901A98A0004DF91 for caml-list@inria.fr; Sat, 25 Oct 2008 21:19:10 +0200 Received: from mfp by NANA.localdomain with local (Exim 4.69) (envelope-from ) id 1KtofG-00011B-2W for caml-list@inria.fr; Sat, 25 Oct 2008 21:19:10 +0200 Date: Sat, 25 Oct 2008 21:19:09 +0200 From: Mauricio Fernandez To: caml-list@inria.fr Subject: Re: [Caml-list] Re: Serialisation of PXP DTDs Message-ID: <20081025191909.GH32611@NANA.localdomain> Mail-Followup-To: caml-list@inria.fr References: <20081023210527.GB32611@NANA.localdomain> <278256.11946.qm@web54605.mail.re2.yahoo.com> <20081023233657.GE32611@NANA.localdomain> <20081024213917.GF32611@NANA.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.17+20080114 (2008-01-14) X-Miltered: at concorde with ID 4903712F.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; pxp:01 dtds:01 0200,:01 mikkel:01 rgensen:01 node:01 ocaml's:01 constructors:01 ocaml:01 corresponds:01 complang:01 parser:01 ocaml:01 syntax:01 ocaml's:01 On Sat, Oct 25, 2008 at 12:27:08AM +0200, Mikkel Fahnøe Jørgensen wrote: > > serialization too. My protocol family is both substantially simpler and better > > adapted for extensibility. For example, the generic pretty-printer (able to > > decode any message) takes ~40 lines of code. > > > > I see - somehow it reminds me of stackish - kind of S expressions > backwards I guess - apparently with good performance, but also tag'ed > I reckon. > > http://www.zedshaw.com/essays/stackish_xml_alternative.html heh, I read about Stackish a while ago (a few years?). Besides being human-readable, Stackish uses tags in a different way. Whereas Stackish uses tags for the node names (behaving like Google's Protocol Buffers or Facebook's Thrift in this regard), in my design tags are like OCaml's: a way to encode different constructors for a given field. For instance, if you have a field ... length : float ... and latter decide that a mere float is not enough, and it should be actually type len = Cm of float | Inch of float ... length : float ... my system assigns a tag to each constructor, the way OCaml does (the original type definition carries a default tag which corresponds to the Cm constructor). AFAICS this can only be encoded in a roundabout way in Stackish, since it doesn't have sum types. > More specifically regarding DTD's: > Since I have been playing around with Ragel: http://www.complang.org/ragel/ > I was also wondering about converting DTD's to state-machines with a > stack, then feed them to a Ragel input file and have Ragel produce a > table that can be run by a small interpreter. > I did something similar for an XML parser as a kind of DTD > replacement, although I manually wrote the state-machines and compiled > to C, not a table. > For OCaml you would link in the C interpreter, or rewrite it in OCaml. Turning each data schema into a state-machine sounds like a fair amount of work. What I was looking for and ended up implementing is similar in spirit to bin-prot's "with bin_io" extension, with the difference that the type is specified using a language-independent abstract syntax instead of OCaml's type language, and that the wire format is designed to allow extensions happening in both producers and consumers non-atomically. -- Mauricio Fernandez - http://eigenclass.org