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=2.1 required=5.0 tests=AWL,DNS_FROM_RFC_POST, HTML_MESSAGE,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 C4D8ABB84 for ; Tue, 6 Jan 2009 19:19:02 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqgCAOsuY0nRVciok2dsb2JhbACCPzAtkCs+AQEBAQkJCgkRA657jFoBAwEDhXGCZw X-IronPort-AV: E=Sophos;i="4.36,340,1228086000"; d="scan'208";a="33372643" Received: from wf-out-1314.google.com ([209.85.200.168]) by mail4-smtp-sop.national.inria.fr with ESMTP; 06 Jan 2009 19:19:02 +0100 Received: by wf-out-1314.google.com with SMTP id 24so8634452wfg.15 for ; Tue, 06 Jan 2009 10:19:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:cc:in-reply-to:mime-version:content-type:references :x-google-sender-auth; bh=b/0iKICPusd6ZwkC7aGw4A5SOPW/Rp9yw7lE+5mykgo=; b=S2+VHHPqPYN18GWLh1CHIBVROtTIqcBHorCP0dZdgMRHKKTy6fTcBuCdejDASsXhvP cZE0oOPlNAH3EnMnqIMxa5e5KhIkmHXMgXjYX+9fhBz0l83YogP19EVAZMcCvzGIN4JE aQYHhly12YM0j2xHTDj6BxGwZBe9FbID4ImYM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:references:x-google-sender-auth; b=nwjkZOIy+r5iqX3Fuob9yRUHjvNUeFEjwaceO4EFGjaJ1JnKLwGBlLKBtOkxkDdOw4 3dgfF+5YJcu7/s84mm28JaUaTZK1By3ufewdocbpVtzOPoElI/O8v5HIetKeyla3t81A pVFMPe8HkiKNBQSbSMoCSoJsS7dPBjPqm8TVs= Received: by 10.142.14.18 with SMTP id 18mr9255702wfn.215.1231265940968; Tue, 06 Jan 2009 10:19:00 -0800 (PST) Received: by 10.142.141.5 with HTTP; Tue, 6 Jan 2009 10:19:00 -0800 (PST) Message-ID: Date: Tue, 6 Jan 2009 10:19:00 -0800 From: "Jake Donham" Sender: jake.donham@gmail.com To: "Paolo Donadeo" Subject: Re: [Caml-list] Parsing simple type expressions Cc: "OCaml mailing list" In-Reply-To: <4b5157c30901060603k6d0589d2m469b170dc5ec7c8e@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_200275_33297919.1231265940960" References: <4b5157c30901060603k6d0589d2m469b170dc5ec7c8e@mail.gmail.com> X-Google-Sender-Auth: 955195e91a89f12f X-Spam: no; 0.00; serializer:01 ocaml:01 ocaml:01 camlp:01 camlp:01 serializer:01 2009:98 blog:98 2009:98 blog:98 wrote:01 wrote:01 parsing:01 caml-list:01 tuples:01 ------=_Part_200275_33297919.1231265940960 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Tue, Jan 6, 2009 at 6:03 AM, Paolo Donadeo wrote: > For a serializer I'm writing I need to parse simple OCaml type > expressions composed by OCaml basic types, tuples, options and lists. This is pretty easy with Camlp4, although as you say there isn't much in the docs to point the way. You might take a look at how orpc does it--see the parse_type function in http://code.google.com/p/orpc2/source/browse/trunk/src/generator/parse.ml (I'm going to cover using Camlp4 in this way on the blog I posted yesterday, but not for another week or two.) You might also look at some other Camlp4-based serialization tools, like bin-prot/type-conv at http://www.ocaml.info/home/ocaml_sources.html Jake ------=_Part_200275_33297919.1231265940960 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Tue, Jan 6, 2009 at 6:03 AM, Paolo Donadeo <p.donadeo@gmail.com> wrote:
For a serializer I'm writing I need to parse simple OCaml type
expressions composed by OCaml basic types, tuples, options and lists.

This is pretty easy with Camlp4, although as you say there isn't much in the docs to point the way. You might take a look at how orpc does it--see the parse_type function in

  http://code.google.com/p/orpc2/source/browse/trunk/src/generator/parse.ml

(I'm going to cover using Camlp4 in this way on the blog I posted yesterday, but not for another week or two.)

You might also look at some other Camlp4-based serialization tools, like bin-prot/type-conv at

  http://www.ocaml.info/home/ocaml_sources.html

Jake

------=_Part_200275_33297919.1231265940960--