Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] [Q] camlp4 help (fwd)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Daniel de Rauglaudre <daniel.de_rauglaudre@i...>
Subject: Re: [Caml-list] [Q] camlp4 help (fwd)
Hi,

On Sat, Oct 06, 2001 at 01:29:29AM -0400, jd marrow wrote:

> (1) declare a value named ident0 in the current module, and
> (2) wrap subsequent functional values matching those described in the
>     identifier list with special code...
> can you point me to any camlp4 code that does something which is [even
> remotely] similar?

This is possible. You have to extend the entry Pcaml.str_item
(structure item) with your grammar rule. Both syntaxes ("foo" or
"let foo" should work).

If I undertand your problem well, you want to generate *several* items
from *one* item? For that, you can use the "declare" statement of the
abstract syntax tree.  Your semantic action could be something like:
     let x = ... build your structure items list ...
     <:str_item< declare $list:x$ end >>

If you want more details or if you need more explanations or some help
to write your code, feel free to ask me.

-- 
Daniel de RAUGLAUDRE
daniel.de_rauglaudre@inria.fr
http://cristal.inria.fr/~ddr/
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr