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 IAA12792; Tue, 18 Jun 2002 08:27: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 IAA12852 for ; Tue, 18 Jun 2002 08:27:36 +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 g5I6RaP23286 for ; Tue, 18 Jun 2002 08:27:36 +0200 (MET DST) Received: (from ddr@localhost) by verdot.inria.fr (8.9.3/8.9.3) id IAA15788 for caml-list@inria.fr; Tue, 18 Jun 2002 08:27:35 +0200 Date: Tue, 18 Jun 2002 08:27:35 +0200 From: Daniel de Rauglaudre To: caml-list@inria.fr Subject: Re: [Caml-list] Camlp4: varargs ie a la Printf Message-ID: <20020618082735.G11335@verdot.inria.fr> References: <15629.62581.329369.773250@is002254.saclay.cea.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <15629.62581.329369.773250@is002254.saclay.cea.fr>; from basile.starynkevitch@cea.fr on Mon, Jun 17, 2002 at 04:38:45PM +0200 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, On Mon, Jun 17, 2002 at 04:38:45PM +0200, Basile STARYNKEVITCH wrote: > Pcaml.expr: LEVEL "top" > [ [ "trace" ; trid = UIDENT ; fmt = STRING ; args = LIST0 Pcaml.expr ; "end" -> > let lctrid = String.lowercase trid in > [...] > (Printf.sprintf $str:fmt$ > (**** WHAT SHOULD BE ADDED HERE? *****) John Malecki answered correcly (how to create an AST of a list), but I would just add that "args = LIST0 Pcaml.expr" does not work without separator, because if you have "a b c" on input, it does not return the list of a, b and c, but the application of the function a to b and c. A solution is to call Pcaml.expr at the level just after the application, i.e. for the normal and revised syntaxes: ".": args = LIST0 (Pcaml.expr LEVEL ".) -- Daniel de RAUGLAUDRE daniel.de_rauglaudre@inria.fr 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