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.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 4D16FBC0A for ; Thu, 14 Jun 2007 07:38:07 +0200 (CEST) Received: from stirner.roentgeninstitut.de (stirner.roentgeninstitut.de [212.110.109.210]) by concorde.inria.fr (8.13.6/8.13.6) with SMTP id l5E5c63G004291 for ; Thu, 14 Jun 2007 07:38:07 +0200 Received: (qmail 21126 invoked by uid 1000); 13 Jun 2007 22:38:04 -0700 Date: Wed, 13 Jun 2007 22:38:04 -0700 From: Christian Stork To: caml-list@inria.fr Subject: Camlp4 question on type declarations Message-ID: <20070614053803.GA20489@stirner.roentgeninstitut.de> Mail-Followup-To: caml-list@inria.fr MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Archive: encrypt User-Agent: Mutt/1.5.13 (2006-08-11) X-Miltered: at concorde with ID 4670D43E.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; camlp:01 params:01 params:01 'list':01 expander:01 camlp:01 'list:01 ctyp:01 admittedly:01 constructors:01 806:98 021:98 caml-list:01 writes:01 constraint:01 I'd like to construct a quotation that acts as the following pattern. Ast.StTyp (_, (Ast.TyDcl (_, name, params, t, _))) How can I do this? The obvious attempt <:str_item< type $lid:name$ $list:params$ = $t$ >> doesn't work because the 'list' antiquotation expander is not supported (and AFAIU would be against the "spirit" of the overhault camlp4, altho I wouldn't know why in this case). There seem to be two problems. First, if one writes <:str_item< type $lid:name$ $params$ = $t$ >> (without the 'list:') then this pattern only matches a single parameter. <:str_item< type $name_and_params$ = $t$ >> doesn't work, even though one could think of name_and_params as a single ctyp where name is applied to the params. (Wouldn't that be more consistet with the modeling of type application in the rest of camlp4?) Second problem: the above patterns only match type declarations without any constraints. Something like <:str_item< type $lid:name$ $param$ = $t$ $_$ >> doesn't work either. (Admittedly, that would be hard to decypher anyway.) The following only matches exactly one constraint. <:str_item< type $lid:name$ $param$ = $t$ constraint $_$ = $_$ >> Any solutions or do I have to fall back on using the underlying AST constructors? -- Chris Stork <> Support eff.org! <> http://www.ics.uci.edu/~cstork/ OpenPGP fingerprint: B08B 602C C806 C492 D069 021E 41F3 8C8D 50F9 CA2F