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.0 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 960ABBC6B for ; Wed, 27 Jun 2007 10:08:18 +0200 (CEST) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.243]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l5R88Hgs022183 for ; Wed, 27 Jun 2007 10:08:18 +0200 Received: by an-out-0708.google.com with SMTP id b15so21657ana for ; Wed, 27 Jun 2007 01:08:17 -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:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=bkZ0kK9C4zxm5k4kudw2oqsYZNdVH+TCv0UX7kREajBmVWzqOlAjyl2QB2+Bf5c5CCv4GJ5gtQSB2+w80e4tme+5FQcmryFffGS6QV74ZZuptBKvD2NAA+LbEdY4TmbUR7u9GYGfrtDmsBcAID19dPpPoni5zfaarQ0+exLCGes= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=QDeZexoDCl2A5iKpirD9aD9SHShY0qqgQoa2iTLsS1wZf1qyum0cU9qu7psqFvtwo/Qmw2oduhgYeiKoad6RimpnVrHQ9X/CQ/nMwCtx9NKjbkf2pheFke/iUeuyW3Dt7TcjLUT6DLLsyvDbYm/yQjwop0ZrpgCAEP+9KNntx9k= Received: by 10.100.163.12 with SMTP id l12mr139311ane.1182931697416; Wed, 27 Jun 2007 01:08:17 -0700 (PDT) Received: by 10.100.33.15 with HTTP; Wed, 27 Jun 2007 01:08:17 -0700 (PDT) Message-ID: <6f9f8f4a0706270108i10eeef7eme5c1a397158d85c4@mail.gmail.com> Date: Wed, 27 Jun 2007 10:08:17 +0200 From: "Loup Vaillant" To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] C-like macros in OCaml In-Reply-To: <46821522.80602@ed.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1B4EC64C-435D-42C5-95F3-C01869DD41FB@rice.edu> <20070627041034.GA7232@furbychan.cocan.org> <46821522.80602@ed.ac.uk> X-j-chkmail-Score: MSGID : 46821AF1.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 46821AF1.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; c-like:01 ocaml:01 c-like:01 ocaml:01 foo:01 ml':01 camlp:01 foo:01 camlp:01 idem:01 pointer:01 26,:98 wrote:01 wrote:01 preprocessor:01 2007/6/27, Jeremy Yallop : > Richard Jones wrote: > > On Tue, Jun 26, 2007 at 05:00:40PM -0500, Raj B wrote: > >> Hi there > >> > >> Is there any way I can achieve the use of C-like preprocessor macros > >> in OCaml? > >> i.e. > >> [...] > >[...] > It appears to support them. If you have a file `foo.ml' containing the > following: > [...] By the way, does camlp4 handle cross modules C-like macros? If it does, how? For instance, what if I write, in foo.ml : DEFINE FOO = 1 and then, in bar.ml : let bar = FOO;; or else: open foo;; let bar = FOO;; or even : let bar = Foo.FOO;; Will I get what I want? Now, what about regular quotations? And grammar rules? How can I specify the scope of particular grammar rule (or quotation)? For the little I know about camlp4, once defined, the scope of a new grammar rule is global. (Idem for quotations). Am I right? Any clue about the way camlp4 keep track of new grammar rules an quotations? (Or some pointer to the documentation involved) Thanks Loup Vaillant