From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 348E8BC75 for ; Mon, 21 Feb 2005 13:28:29 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j1LCSSXE010170 for ; Mon, 21 Feb 2005 13:28:28 +0100 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id NAA04017 for ; Mon, 21 Feb 2005 13:28:28 +0100 (MET) Received: from alex.barettalocal.com (h213-255-109-130.albacom.net [213.255.109.130] (may be forged)) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j1LCSRTi021361 for ; Mon, 21 Feb 2005 13:28:27 +0100 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by alex.barettalocal.com (Postfix) with ESMTP id 834D22BAB37; Mon, 21 Feb 2005 13:28:25 +0100 (CET) Message-ID: <4219D3E9.80003@barettadeit.com> Date: Mon, 21 Feb 2005 13:28:25 +0100 From: Alex Baretta User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20050105 Debian/1.7.5-1 X-Accept-Language: it, en-us, en MIME-Version: 1.0 To: Hendrik Tews Cc: Ocaml Subject: Re: [Caml-list] Camlp4 with traditional syntax (was: Camlp4 documentation) References: <4215A18C.7040603@barettadeit.com> <4215AD36.1070303@cs.unisa.edu.au> <42161793.7030704@barettadeit.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 4219D3EC.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 4219D3EB.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; baretta:01 caml-list:01 syntax:01 hendrik:01 tews:01 wrote:01 baretta:01 expander:01 bypassing:01 expr:01 struct:01 ocaml:01 expander:01 ocaml:01 iirc:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.2 X-Spam-Level: Hendrik Tews wrote: > Alex Baretta writes: > > There is one more issue with Camlp4: it does not allow for quotations > to expand to generic syntactic elements. Often, I use quotations which > expand to module definitions. I had to implement my own quotation > expander, bypassing the limitations of Camlp4 to achieve this. > > I don't quite understand, what's wrong with > > let me = <:module_expr< struct $ list of module def's $ end >> > in > <:str_item< module $some_name$ = $me$ >> We use quotation expanders to embed completely different languages, such as SQL, within Ocaml code. Specifically, the SQL quotation expander compiles SQL code to an Ocaml module. CamlP4 signals an error because quotations are only meant to be used as expressions or as patterns, IIRC. Anyhow, the solution is either to use ocpp rather than camlp4 as a preprocessor (ocpp is less picky), or to write one's own quotation preprocessor. We use both techniques depending on the context. Alex -- ********************************************************************* http://www.barettadeit.com/ Baretta DE&IT A division of Baretta SRL tel. +39 02 370 111 55 fax. +39 02 370 111 54 Our technology: The Application System/Xcaml (AS/Xcaml) The FreerP Project