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.0 required=5.0 tests=AWL,DNS_FROM_RFC_POST, 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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id AEDEDBC54 for ; Mon, 15 Jun 2009 00:11:11 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4CANoRNUrRVdrPmGdsb2JhbACYBz8BAQEBAQgJDAcTqGeBGI1hAQMCBIQJBQ X-IronPort-AV: E=Sophos;i="4.42,218,1243807200"; d="scan'208";a="28057049" Received: from mail-bw0-f207.google.com ([209.85.218.207]) by mail2-smtp-roc.national.inria.fr with ESMTP; 15 Jun 2009 00:11:11 +0200 Received: by bwz3 with SMTP id 3so3104031bwz.27 for ; Sun, 14 Jun 2009 15:11:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=Sqe4eLRVGqmd+S3R4QYhoNzMaC5i9DSp0km+ZRB+UeM=; b=n5e6JnHJM79OSZauGqGvNNm6eCygYIKE9E2SDlVsphpdB6nOrg9CqjvmcFQh64s+6L HHRRZBmAag2iYRSAzv3gz4qM+V7FIGbQ4PdjV3gIXSk3lXDSBQSTU/W4ThoonLuefY1k QBAIQhlVYLqvRElR67PBpncfbWQOr/dEdcaO4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=h02go74oy1dZ+/GO5gnr+OnEPfHJD26HL5YQgxRnWZNDbrWpi/9/6JE3jcYbYgYiGR GSMAHvWrpYS3Kgd2TZgnkf7r58PXuntFNsyUY8mZLCdI5iAQnc6y3Q1TrI5W8ii5HeUf 0/s2QAQTn/6UuszL9f+iZL7drYplEStxa17Xg= MIME-Version: 1.0 Received: by 10.204.59.76 with SMTP id k12mr6324497bkh.136.1245017471034; Sun, 14 Jun 2009 15:11:11 -0700 (PDT) In-Reply-To: References: Date: Mon, 15 Jun 2009 00:11:11 +0200 Message-ID: <527cf6bc0906141511g7c978432ie0813a55d1e07a45@mail.gmail.com> Subject: Re: [Caml-list] defining recursive types with camlp4 From: blue storm To: Jacques Le Normand Cc: caml-list caml-list Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; recursive:01 camlp:01 ctyp:01 ctyp:01 node:01 syntax:01 decl:01 constructors:01 constructors:01 decl:01 storm:98 2009:98 wrote:01 caml-list:01 ast:02 On Sun, Jun 14, 2009 at 11:10 PM, Jacques Le Normand wrote: > how would I go about writing such a function? The "... and ..." multiple-declaration isn't at the str_item level but at the ctyp level. You should use <:ctyp< $..$ and $...$ >>. Moreover, it appears that the type declaration node in the AST (Ast.TyDcl) does not have a quotation syntax : <:str_item< type $..$ = $...$ >> won't work. let type_chain _loc lst = let decl (name, constructors) = Ast.TyDcl(_loc, name, [], constructors, []) in <:str_item< type $Ast.tyAnd_of_list (List.map decl lst)$ >>