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=AWL,HTML_MESSAGE 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 D0B3ABC6B for ; Tue, 24 Jul 2007 23:23:39 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [143.182.124.21]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l6OLNbGK015194 for ; Tue, 24 Jul 2007 23:23:38 +0200 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 24 Jul 2007 14:23:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.16,575,1175497200"; d="scan'208,217";a="254263432" Received: from orsmsx335.jf.intel.com ([10.22.226.40]) by azsmga001.ch.intel.com with ESMTP; 24 Jul 2007 14:23:34 -0700 Received: from orsmsx419.amr.corp.intel.com ([10.22.226.88]) by orsmsx335.jf.intel.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 24 Jul 2007 14:23:34 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C7CE38.E425F15F" Subject: Equivalent of Quotation.ExStr in new camlp4? Date: Tue, 24 Jul 2007 14:23:34 -0700 Message-ID: <509223F0BF55E74FA1247D17207E7A0C01B11E32@orsmsx419.amr.corp.intel.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Equivalent of Quotation.ExStr in new camlp4? Thread-Index: AcfOOOP4bYPhd2PRRHC7HLePcz+LVQ== From: "Harrison, John R" To: Cc: "Harrison, John R" X-OriginalArrivalTime: 24 Jul 2007 21:23:34.0393 (UTC) FILETIME=[E41CC690:01C7CE38] X-j-chkmail-Score: MSGID : 46A66DD9.002 on concorde : j-chkmail score : XXX : 5/20 1 0.000 -> 3 X-Miltered: at concorde with ID 46A66DD9.002 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; camlp:01 camlp:01 parser:01 ocaml:01 parser:01 expander:01 ocaml:01 expander:01 parse:02 parse:02 string:02 string:02 arial:96 arial:96 multi-part:94 This is a multi-part message in MIME format. ------_=_NextPart_001_01C7CE38.E425F15F Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable In the old camlp4 one could set up a quotation parser to just apply a string transformation and thereafter parse with the usual OCaml parser, e.g. =20 Quotation.add name (Quotation.ExStr expander) =20 What is the equivalent in the new camlp4? =20 John. =20 ------_=_NextPart_001_01C7CE38.E425F15F Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

In the old camlp4 one could set up a quotation parser = to just apply a string

transformation and thereafter parse with the usual = OCaml parser, e.g.

 

  Quotation.add name (Quotation.ExStr = expander)

 

What is the equivalent in the new = camlp4?

 

John.

 

------_=_NextPart_001_01C7CE38.E425F15F-- 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 discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id A02D4BC6B for ; Wed, 25 Jul 2007 13:40:39 +0200 (CEST) Received: from smtp4-g19.free.fr (smtp4-g19.free.fr [212.27.42.30]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l6PBedDR006392 for ; Wed, 25 Jul 2007 13:40:39 +0200 Received: from smtp4-g19.free.fr (localhost.localdomain [127.0.0.1]) by smtp4-g19.free.fr (Postfix) with ESMTP id BB7336F375 for ; Wed, 25 Jul 2007 13:40:37 +0200 (CEST) Received: from kerneis.info (kerneis.info [82.224.215.18]) by smtp4-g19.free.fr (Postfix) with ESMTP id 7FE126F330 for ; Wed, 25 Jul 2007 13:40:37 +0200 (CEST) Received: from localhost ([127.0.0.1] helo=tatanka.kerneis.info ident=gabriel) by kerneis.info with esmtp (Exim 4.63) (envelope-from ) id 1IDfEK-0001Km-5d for caml-list@yquem.inria.fr; Wed, 25 Jul 2007 13:40:36 +0200 Date: Wed, 25 Jul 2007 13:40:25 +0200 From: Gabriel Kerneis To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Equivalent of Quotation.ExStr in new camlp4? In-Reply-To: <509223F0BF55E74FA1247D17207E7A0C01B11E32@orsmsx419.amr.corp.intel.com> References: <509223F0BF55E74FA1247D17207E7A0C01B11E32@orsmsx419.amr.corp.intel.com> Organization: ENST X-Mailer: Claws Mail 2.10.0 (GTK+ 2.10.13; i486-pc-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_vdH/GXhGnnFuFzn5ptJHMsU"; protocol="application/pgp-signature"; micalg=PGP-SHA1 Message-Id: X-Miltered: at discorde with ID 46A736B7.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; camlp:01 camlp:01 parser:01 ocaml:01 parser:01 expander:01 syntax:01 syntax:01 expr:01 pat:01 caml-list:01 exp:02 exp:02 parse:02 string:02 X-Attachments: type="application/pgp-signature" name="signature.asc" name="signature.asc" --Sig_vdH/GXhGnnFuFzn5ptJHMsU Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Le Tue, 24 Jul 2007 14:23:34 -0700, "Harrison, John R" a =E9crit : > In the old camlp4 one could set up a quotation parser to just apply a > string > transformation and thereafter parse with the usual OCaml parser, e.g. > Quotation.add name (Quotation.ExStr expander) > What is the equivalent in the new camlp4? In Ocsigen, Quotation.add "xml" (Quotation.ExAst (xml_exp, xml_pat)) became open Camlp4.PreCast ; Syntax.Quotation.add "xml" Syntax.Quotation.DynAst.expr_tag Parser.xml_exp Maybe this can give you a clue ? Regards, --=20 Gabriel Kerneis --Sig_vdH/GXhGnnFuFzn5ptJHMsU Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFGpzaw6a2JmXQu5bYRAlraAKCd/GFUXVY6sJ6DZnpXczJ8OPo8KgCfQpJx 29bToQlX7CLI2x9dRM+64C4= =mDWG -----END PGP SIGNATURE----- --Sig_vdH/GXhGnnFuFzn5ptJHMsU-- 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=1.1 required=5.0 tests=AWL,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 discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 028ACBC6B for ; Wed, 25 Jul 2007 18:14:33 +0200 (CEST) Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.237]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l6PGEWW4030650 for ; Wed, 25 Jul 2007 18:14:32 +0200 Received: by nz-out-0506.google.com with SMTP id x7so184892nzc for ; Wed, 25 Jul 2007 09:14:31 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=jAicdJCwN3mesQU8bjh7co/qQ98wgLkDixqbABV/j3QBdcxnMgxsMPI5yGSFTFktRTzaZakcX7c2OiSYw8xneMA9Toj1BtFdg5P9w/F2Z7ynacXbcX7wjrKycPMeRn7jcLGaGOvfUkafEcNCAxkJXlWiOhQQmroSHxj+0QHs12g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=fSg2007d6O2hl+OCe4KY2pfX5dHaM427VoECl+5IGsIL3x4DV8YZleXamwIdima4v9Q5qBtRpJMTS3h5Tdt2YjjUD8vFS1+nrWWflj0ZZXA9JgO/+G7E3oTwEJ6qsv7AH9KWRYBsxoSQlz5XqlcSadrGaZOk+OydcG6IEtO1jn8= Received: by 10.114.156.1 with SMTP id d1mr789723wae.1185380068695; Wed, 25 Jul 2007 09:14:28 -0700 (PDT) Received: by 10.114.181.9 with HTTP; Wed, 25 Jul 2007 09:14:28 -0700 (PDT) Message-ID: Date: Wed, 25 Jul 2007 18:14:28 +0200 From: "Nicolas Pouillard" To: "Harrison, John R" Subject: Re: [Caml-list] Equivalent of Quotation.ExStr in new camlp4? Cc: caml-list@yquem.inria.fr In-Reply-To: <509223F0BF55E74FA1247D17207E7A0C01B11E32@orsmsx419.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <509223F0BF55E74FA1247D17207E7A0C01B11E32@orsmsx419.amr.corp.intel.com> X-j-chkmail-Score: MSGID : 46A776E8.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 46A776E8.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; camlp:01 parser:01 expander:01 camlp:01 parser:01 ocaml:01 expander:01 wrote:01 caml-list:01 ast:02 parse:02 supported:02 string:02 string:02 usual:06 Hello, No ExStr is no more supported. But you can do it your self by calling the parser on your string if you really don't want switch to an AST based quotation expander. Regards, On 7/24/07, Harrison, John R wrote: > > > > > In the old camlp4 one could set up a quotation parser to just apply a string > > transformation and thereafter parse with the usual OCaml parser, e.g. > > > > Quotation.add name (Quotation.ExStr expander) > > > > What is the equivalent in the new camlp4? > > > > John. > -- Nicolas Pouillard 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=AWL 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 782CEBC6B for ; Wed, 25 Jul 2007 18:14:39 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l6PGEbBB004472 for ; Wed, 25 Jul 2007 18:14:38 +0200 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 25 Jul 2007 09:14:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.16,581,1175497200"; d="scan'208";a="270475949" Received: from orsmsx335.jf.intel.com ([10.22.226.40]) by orsmga001.jf.intel.com with ESMTP; 25 Jul 2007 09:14:36 -0700 Received: from orsmsx419.amr.corp.intel.com ([10.22.226.88]) by orsmsx335.jf.intel.com with Microsoft SMTPSVC(6.0.3790.1830); Wed, 25 Jul 2007 09:14:33 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: [Caml-list] Equivalent of Quotation.ExStr in new camlp4? Date: Wed, 25 Jul 2007 09:14:32 -0700 Message-ID: <509223F0BF55E74FA1247D17207E7A0C01B120B8@orsmsx419.amr.corp.intel.com> In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [Caml-list] Equivalent of Quotation.ExStr in new camlp4? Thread-Index: AcfOsWTwJHG3ioHmQhuLYT+fiM0SHAAJObAA From: "Harrison, John R" To: "Gabriel Kerneis" , Cc: "Harrison, John R" X-OriginalArrivalTime: 25 Jul 2007 16:14:33.0322 (UTC) FILETIME=[E32F9CA0:01C7CED6] X-Miltered: at concorde with ID 46A776ED.003 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; camlp:01 camlp:01 syntax:01 syntax:01 expr:01 parser:01 ocaml:01 parser:01 pat:01 caml-list:01 ast:02 exp:02 exp:02 string:02 transform:05 | In Ocsigen, | Quotation.add "xml" (Quotation.ExAst (xml_exp, xml_pat)) | became | open Camlp4.PreCast ; | Syntax.Quotation.add "xml" Syntax.Quotation.DynAst.expr_tag | Parser.xml_exp |=20 | Maybe this can give you a clue ? Maybe, but I was looking for the equivalent of Quotation.ExStr rather than Quotation.ExAst, i.e. apply a string transform then the usual OCaml parser rather than my own parser producing an AST. John. 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=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id E6CBFBC6B for ; Wed, 25 Jul 2007 18:23:13 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l6PGNCkJ032376 for ; Wed, 25 Jul 2007 18:23:13 +0200 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 25 Jul 2007 09:23:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.16,581,1175497200"; d="scan'208";a="109847817" Received: from orsmsx335.jf.intel.com ([10.22.226.40]) by fmsmga002.fm.intel.com with ESMTP; 25 Jul 2007 09:23:11 -0700 Received: from orsmsx419.amr.corp.intel.com ([10.22.226.88]) by orsmsx335.jf.intel.com with Microsoft SMTPSVC(6.0.3790.1830); Wed, 25 Jul 2007 09:23:10 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: [Caml-list] Equivalent of Quotation.ExStr in new camlp4? Date: Wed, 25 Jul 2007 09:23:10 -0700 Message-ID: <509223F0BF55E74FA1247D17207E7A0C01B120CA@orsmsx419.amr.corp.intel.com> In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [Caml-list] Equivalent of Quotation.ExStr in new camlp4? Thread-Index: AcfO1uOxih4s66JzRRCCW4fgGi3tVwAAEJXw From: "Harrison, John R" To: "Nicolas Pouillard" Cc: X-OriginalArrivalTime: 25 Jul 2007 16:23:10.0656 (UTC) FILETIME=[178A8400:01C7CED8] X-Miltered: at discorde with ID 46A778F0.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; camlp:01 parser:01 expander:01 concretely:01 expander:01 caml-list:01 ast:02 supported:02 string:02 quotation:08 quotation:08 fun:08 john:08 john:08 equivalent:09 | No ExStr is no more supported. But you can do it your self by calling | the parser on your string if you really don't want switch to an AST | based quotation expander. OK, that's fine. But how do I do that? Concretely, this is what I had before, so what should I have now? Quotation.add "" (Quotation.ExStr (fun x -> quotexpander));; I don't mind in principle writing an AST-producing expander, but at the moment the priority is to get my code working in 3.10 with minimal expenditure of effort. John. 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=1.1 required=5.0 tests=AWL,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 discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id BFA3FBC6B for ; Thu, 26 Jul 2007 10:44:06 +0200 (CEST) Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.178]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l6Q8i4dJ018934 for ; Thu, 26 Jul 2007 10:44:06 +0200 Received: by wa-out-1112.google.com with SMTP id k17so219864waf for ; Thu, 26 Jul 2007 01:44:04 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=URpzWBhg4vpb1WxS2yVX0LNji+atuDzxU4Fkjf6+jwJfAsHjXwA5l/dlY8CgR7mTfP6CshygEjT+7MQVKMjVmZhkxiB02mbsxjhrt7RkUYzw0w8HB3xCJKF0m49/cTWnEO8RyxaOOkokqrdBtz6z7PHraD5kyMwVFVwfJLwYI/o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=gqU37WGkypTurzqFLQJTr/H9gaooKNIVE484dP2kcRho7ZpAznQImyicoHr4YFovIpY6yP0qD/xaqb9FzTtImepVMed9+NYMj4fMmxgmcEhBD9sIqedD0eWyV9WUNMmNX2aH39ttstJEmQsAtwUmtAmSRr23MuAl5GD25+iOby4= Received: by 10.114.93.17 with SMTP id q17mr1503198wab.1185439444119; Thu, 26 Jul 2007 01:44:04 -0700 (PDT) Received: by 10.114.181.8 with HTTP; Thu, 26 Jul 2007 01:44:04 -0700 (PDT) Message-ID: Date: Thu, 26 Jul 2007 10:44:04 +0200 From: "Nicolas Pouillard" To: "Harrison, John R" Subject: Re: [Caml-list] Equivalent of Quotation.ExStr in new camlp4? Cc: caml-list@yquem.inria.fr In-Reply-To: <509223F0BF55E74FA1247D17207E7A0C01B120CA@orsmsx419.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <509223F0BF55E74FA1247D17207E7A0C01B120CA@orsmsx419.amr.corp.intel.com> X-j-chkmail-Score: MSGID : 46A85ED5.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 46A85ED5.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; camlp:01 parser:01 expander:01 concretely:01 expander:01 instanciate:01 ocaml:01 parser:01 camlp:01 expr:01 expr:01 syntax:01 syntax:01 ocamlc:01 -pp:01 On 7/25/07, Harrison, John R wrote: > | No ExStr is no more supported. But you can do it your self by calling > | the parser on your string if you really don't want switch to an AST > | based quotation expander. > > OK, that's fine. But how do I do that? Concretely, this is what I had > before, so what should I have now? > > Quotation.add "" (Quotation.ExStr (fun x -> quotexpander));; > > I don't mind in principle writing an AST-producing expander, but at the > moment the priority is to get my code working in 3.10 with minimal > expenditure of effort. > You can instanciate an OCaml parser that way: $ cat ex_str.mlmodule Caml = Camlp4OCamlParser.Make (Camlp4OCamlRevisedParser.Make (Camlp4.OCamlInitSyntax.Make(Ast)(Gram)(Quotation)));; let quotexpander str = "[1; 2; 3]" (* ... do some real code on str *) let patt_quotexpander loc _loc_name_opt str = Gram.parse_string Caml.patt loc (quotexpander str) let expr_quotexpander loc _loc_name_opt str = Gram.parse_string Caml.expr loc (quotexpander str) let str_item_quotexpander loc loc_name_opt str = <:str_item@loc< $exp: expr_quotexpander loc loc_name_opt str$ >> let () = Syntax.Quotation.add "" Syntax.Quotation.DynAst.expr_tag expr_quotexpander; Syntax.Quotation.add "" Syntax.Quotation.DynAst.str_item_tag str_item_quotexpander; Syntax.Quotation.add "" Syntax.Quotation.DynAst.patt_tag patt_quotexpander $ ocamlc -pp camlp4of -I +camlp4 -c ex_str.ml $ camlp4o ./ex_str.cmo -str '<<>>;;' HTH -- Nicolas Pouillard 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=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 5DAFDBC6B for ; Thu, 26 Jul 2007 18:49:24 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [143.182.124.21]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l6QGnLfn020214 for ; Thu, 26 Jul 2007 18:49:23 +0200 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 26 Jul 2007 09:49:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.16,584,1175497200"; d="scan'208";a="255154543" Received: from orsmsx334.jf.intel.com ([10.22.226.45]) by azsmga001.ch.intel.com with ESMTP; 26 Jul 2007 09:49:20 -0700 Received: from orsmsx419.amr.corp.intel.com ([10.22.226.88]) by orsmsx334.jf.intel.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 26 Jul 2007 09:49:20 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: [Caml-list] Equivalent of Quotation.ExStr in new camlp4? Date: Thu, 26 Jul 2007 09:49:19 -0700 Message-ID: <509223F0BF55E74FA1247D17207E7A0C01B12606@orsmsx419.amr.corp.intel.com> In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [Caml-list] Equivalent of Quotation.ExStr in new camlp4? Thread-Index: AcfPYR99bCAC3sH9RoCQaht14LlfgAAQ5vgg From: "Harrison, John R" To: "Nicolas Pouillard" Cc: X-OriginalArrivalTime: 26 Jul 2007 16:49:20.0402 (UTC) FILETIME=[E9987F20:01C7CFA4] X-Miltered: at discorde with ID 46A8D091.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; camlp:01 ocamlc:01 -pp:01 camlp:01 toplevel:01 parser:01 expander:01 concretely:01 expander:01 instanciate:01 ocaml:01 parser:01 expr:01 expr:01 syntax:01 Trying your example in 3.10.0, I get the following: | $ ocamlc -pp camlp4of -I +camlp4 -c ex_str.ml | File "ex_str.ml", line 2, characters 2-24: | Unbound module Camlp4OCamlParser.Make I get a similar error in the toplevel even after #load "camlp4o.cma". Do I need to load and/or open something else? John. -----Original Message----- From: Nicolas Pouillard [mailto:nicolas.pouillard@gmail.com]=20 Sent: Thursday, July 26, 2007 1:44 AM To: Harrison, John R Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Equivalent of Quotation.ExStr in new camlp4? On 7/25/07, Harrison, John R wrote: > | No ExStr is no more supported. But you can do it your self by calling > | the parser on your string if you really don't want switch to an AST > | based quotation expander. > > OK, that's fine. But how do I do that? Concretely, this is what I had > before, so what should I have now? > > Quotation.add "" (Quotation.ExStr (fun x -> quotexpander));; > > I don't mind in principle writing an AST-producing expander, but at the > moment the priority is to get my code working in 3.10 with minimal > expenditure of effort. > You can instanciate an OCaml parser that way: $ cat ex_str.mlmodule Caml =3D Camlp4OCamlParser.Make (Camlp4OCamlRevisedParser.Make (Camlp4.OCamlInitSyntax.Make(Ast)(Gram)(Quotation)));; let quotexpander str =3D "[1; 2; 3]" (* ... do some real code on str *) let patt_quotexpander loc _loc_name_opt str =3D Gram.parse_string Caml.patt loc (quotexpander str) let expr_quotexpander loc _loc_name_opt str =3D Gram.parse_string Caml.expr loc (quotexpander str) let str_item_quotexpander loc loc_name_opt str =3D <:str_item@loc< $exp: expr_quotexpander loc loc_name_opt str$ >> let () =3D Syntax.Quotation.add "" Syntax.Quotation.DynAst.expr_tag expr_quotexpander; Syntax.Quotation.add "" Syntax.Quotation.DynAst.str_item_tag str_item_quotexpander; Syntax.Quotation.add "" Syntax.Quotation.DynAst.patt_tag patt_quotexpander $ ocamlc -pp camlp4of -I +camlp4 -c ex_str.ml $ camlp4o ./ex_str.cmo -str '<<>>;;' HTH --=20 Nicolas Pouillard 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=1.1 required=5.0 tests=AWL,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 discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id E7F78BC6B for ; Thu, 9 Aug 2007 20:31:39 +0200 (CEST) Received: from ausone.inria.fr (peray.inria.fr [128.93.8.98]) by discorde.inria.fr (8.13.6/8.13.6) with SMTP id l79IVbBC009846; Thu, 9 Aug 2007 20:31:37 +0200 Received: by ausone.inria.fr (sSMTP sendmail emulation); Thu, _d Aug 2007 20:31:15 +0200 From: "Nicolas Pouillard" Cc: "O'Caml Mailing List" Subject: RE: [Caml-list] Equivalent of Quotation.ExStr in new camlp4? To: Harrison John R References: <509223F0BF55E74FA1247D17207E7A0C01B12606@orsmsx419.amr.corp.intel.com> In-Reply-To: <509223F0BF55E74FA1247D17207E7A0C01B12606@orsmsx419.amr.corp.intel.com> Date: Thu, 09 Aug 2007 20:31:15 +0200 Message-Id: <1186684229-sup-4122@ert.local> User-Agent: Sup/0.1.$Revision:$ Content-Disposition: inline Content-Type: text/plain; charset=utf-8 X-j-chkmail-Score: MSGID : 46BB5D89.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 46BB5D89.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; camlp:01 camlp:01 parsers:01 ocamlc:01 -pp:01 toplevel:01 parser:01 expander:01 concretely:01 expander:01 instanciate:01 ocaml:01 parser:01 expr:01 expr:01 Sorry, I used ocamlbuild to use this example and show it without ;( I forgot -I +camlp4/Camlp4Parsers Excerpts from Harrison, John R's message of Thu Jul 26 18:49:19 +0200 2007: > Trying your example in 3.10.0, I get the following: > > | $ ocamlc -pp camlp4of -I +camlp4 -c ex_str.ml > | File "ex_str.ml", line 2, characters 2-24: > | Unbound module Camlp4OCamlParser.Make > > I get a similar error in the toplevel even after #load "camlp4o.cma". > Do I need to load and/or open something else? > > John. > > -----Original Message----- > From: Nicolas Pouillard [mailto:nicolas.pouillard@gmail.com] > Sent: Thursday, July 26, 2007 1:44 AM > To: Harrison, John R > Cc: caml-list@yquem.inria.fr > Subject: Re: [Caml-list] Equivalent of Quotation.ExStr in new camlp4? > > On 7/25/07, Harrison, John R wrote: > > | No ExStr is no more supported. But you can do it your self by > calling > > | the parser on your string if you really don't want switch to an AST > > | based quotation expander. > > > > OK, that's fine. But how do I do that? Concretely, this is what I had > > before, so what should I have now? > > > > Quotation.add "" (Quotation.ExStr (fun x -> quotexpander));; > > > > I don't mind in principle writing an AST-producing expander, but at > the > > moment the priority is to get my code working in 3.10 with minimal > > expenditure of effort. > > > > You can instanciate an OCaml parser that way: > > $ cat ex_str.mlmodule Caml = > Camlp4OCamlParser.Make > (Camlp4OCamlRevisedParser.Make > (Camlp4.OCamlInitSyntax.Make(Ast)(Gram)(Quotation)));; > > let quotexpander str = > "[1; 2; 3]" (* ... do some real code on str *) > > let patt_quotexpander loc _loc_name_opt str = > Gram.parse_string Caml.patt loc (quotexpander str) > > let expr_quotexpander loc _loc_name_opt str = > Gram.parse_string Caml.expr loc (quotexpander str) > > let str_item_quotexpander loc loc_name_opt str = > <:str_item@loc< $exp: expr_quotexpander loc loc_name_opt str$ >> > > let () = > Syntax.Quotation.add "" Syntax.Quotation.DynAst.expr_tag > expr_quotexpander; > Syntax.Quotation.add "" Syntax.Quotation.DynAst.str_item_tag > str_item_quotexpander; > Syntax.Quotation.add "" Syntax.Quotation.DynAst.patt_tag > patt_quotexpander > > $ ocamlc -pp camlp4of -I +camlp4 -c ex_str.ml > $ camlp4o ./ex_str.cmo -str '<<>>;;' > > HTH > > -- > Nicolas Pouillard -- Nicolas Pouillard aka Ertai 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 E9767BC69 for ; Wed, 22 Aug 2007 20:04:33 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l7MGLoWG006406 for ; Wed, 22 Aug 2007 18:21:51 +0200 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 22 Aug 2007 09:21:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.19,295,1183359600"; d="scan'208";a="286459879" Received: from orsmsx334.jf.intel.com ([10.22.226.45]) by fmsmga001.fm.intel.com with ESMTP; 22 Aug 2007 09:21:49 -0700 Received: from orsmsx419.amr.corp.intel.com ([10.22.226.88]) by orsmsx334.jf.intel.com with Microsoft SMTPSVC(6.0.3790.1830); Wed, 22 Aug 2007 09:21:49 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: [Caml-list] Equivalent of Quotation.ExStr in new camlp4? Date: Wed, 22 Aug 2007 09:21:48 -0700 Message-ID: <509223F0BF55E74FA1247D17207E7A0C01CA3998@orsmsx419.amr.corp.intel.com> In-Reply-To: <1186684229-sup-4122@ert.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [Caml-list] Equivalent of Quotation.ExStr in new camlp4? Thread-Index: Acfas4duYwVg+/GAS4islSUL6H3x9gKJLLFg References: <509223F0BF55E74FA1247D17207E7A0C01B12606@orsmsx419.amr.corp.intel.com> <1186684229-sup-4122@ert.local> From: "Harrison, John R" To: "Nicolas Pouillard" Cc: "O'Caml Mailing List" X-OriginalArrivalTime: 22 Aug 2007 16:21:49.0329 (UTC) FILETIME=[8AA20010:01C7E4D8] X-Miltered: at concorde with ID 46CC629E.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; camlp:01 camlp:01 o'caml:01 parsers:01 ocamlc:01 -pp:01 toplevel:01 parser:01 expander:01 concretely:01 expander:01 instanciate:01 ocaml:01 parser:01 expr:01 Thanks; unfortunately in the gap between your two messages I really needed to get my code running, so I just took the path of least resistance and switched to camlp5. But I'll re-examine this in the future when I have more time. John. -----Original Message----- From: Nicolas Pouillard [mailto:nicolas.pouillard@gmail.com]=20 Sent: Thursday, August 09, 2007 11:31 AM To: Harrison, John R Cc: O'Caml Mailing List Subject: RE: [Caml-list] Equivalent of Quotation.ExStr in new camlp4? Sorry, I used ocamlbuild to use this example and show it without ;( I forgot -I +camlp4/Camlp4Parsers Excerpts from Harrison, John R's message of Thu Jul 26 18:49:19 +0200 2007: > Trying your example in 3.10.0, I get the following: >=20 > | $ ocamlc -pp camlp4of -I +camlp4 -c ex_str.ml > | File "ex_str.ml", line 2, characters 2-24: > | Unbound module Camlp4OCamlParser.Make >=20 > I get a similar error in the toplevel even after #load "camlp4o.cma". > Do I need to load and/or open something else? >=20 > John. >=20 > -----Original Message----- > From: Nicolas Pouillard [mailto:nicolas.pouillard@gmail.com]=20 > Sent: Thursday, July 26, 2007 1:44 AM > To: Harrison, John R > Cc: caml-list@yquem.inria.fr > Subject: Re: [Caml-list] Equivalent of Quotation.ExStr in new camlp4? >=20 > On 7/25/07, Harrison, John R wrote: > > | No ExStr is no more supported. But you can do it your self by > calling > > | the parser on your string if you really don't want switch to an AST > > | based quotation expander. > > > > OK, that's fine. But how do I do that? Concretely, this is what I had > > before, so what should I have now? > > > > Quotation.add "" (Quotation.ExStr (fun x -> quotexpander));; > > > > I don't mind in principle writing an AST-producing expander, but at > the > > moment the priority is to get my code working in 3.10 with minimal > > expenditure of effort. > > >=20 > You can instanciate an OCaml parser that way: >=20 > $ cat ex_str.mlmodule Caml =3D > Camlp4OCamlParser.Make > (Camlp4OCamlRevisedParser.Make > (Camlp4.OCamlInitSyntax.Make(Ast)(Gram)(Quotation)));; >=20 > let quotexpander str =3D > "[1; 2; 3]" (* ... do some real code on str *) >=20 > let patt_quotexpander loc _loc_name_opt str =3D > Gram.parse_string Caml.patt loc (quotexpander str) >=20 > let expr_quotexpander loc _loc_name_opt str =3D > Gram.parse_string Caml.expr loc (quotexpander str) >=20 > let str_item_quotexpander loc loc_name_opt str =3D > <:str_item@loc< $exp: expr_quotexpander loc loc_name_opt str$ >> >=20 > let () =3D > Syntax.Quotation.add "" Syntax.Quotation.DynAst.expr_tag > expr_quotexpander; > Syntax.Quotation.add "" Syntax.Quotation.DynAst.str_item_tag > str_item_quotexpander; > Syntax.Quotation.add "" Syntax.Quotation.DynAst.patt_tag > patt_quotexpander >=20 > $ ocamlc -pp camlp4of -I +camlp4 -c ex_str.ml > $ camlp4o ./ex_str.cmo -str '<<>>;;' >=20 > HTH >=20 > --=20 > Nicolas Pouillard --=20 Nicolas Pouillard aka Ertai