From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA29284; Thu, 24 Oct 2002 10:51:37 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 KAA17429 for ; Thu, 24 Oct 2002 10:51:37 +0200 (MET DST) Received: from verdot.inria.fr (verdot.inria.fr [128.93.11.7]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g9O8pa523386 for ; Thu, 24 Oct 2002 10:51:36 +0200 (MET DST) Received: (from ddr@localhost) by verdot.inria.fr (8.9.3/8.9.3) id KAA12464 for caml-list@inria.fr; Thu, 24 Oct 2002 10:51:36 +0200 Date: Thu, 24 Oct 2002 10:51:36 +0200 From: Daniel de Rauglaudre To: caml-list@inria.fr Subject: Re: [Caml-list] Again on pattern matching and strings Message-ID: <20021024105136.C12351@verdot.inria.fr> References: <3DB73515.90705@baretta.com> <15799.14325.887770.501722@karryall.dnsalias.org> <3DB7A4B9.1030607@baretta.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <3DB7A4B9.1030607@baretta.com>; from alex@baretta.com on Thu, Oct 24, 2002 at 09:43:53AM +0200 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, On Thu, Oct 24, 2002 at 09:43:53AM +0200, Alessandro Baretta wrote: > > So yes: CamlP4 can do it. Since I don't want to reinvent the wheel, > has anyone written--and documented for the syntax laymen--such an > extension? I have been thinking to implement that. Proposing a syntax extension to make macros with Camlp4 (in this case, you don't have to write Camlp4 code, but just use the extension file). I propose that syntax: DEFMACRO <(optional-parameters)> = where is input text which can be interpreted as expression or pattern (variables, constants, constructors, records). In this case, the is added as keyword in the grammar, evaluated at parse time, transformed into the depending on its position. The possible parameters are possibly substituted by their actual value in the expression pattern. We can have also: UNDEFMACRO To remove it from the grammar. Would it be OK? General enough? Other propositions? -- Daniel de RAUGLAUDRE http://cristal.inria.fr/~ddr/ ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners