Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Camlp4: varargs ie a la Printf
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-06-18 (06:27)
From: Daniel de Rauglaudre <daniel.de_rauglaudre@i...>
Subject: Re: [Caml-list] Camlp4: varargs ie a la Printf

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

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 ".)

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: