Version française
Home     About     Download     Resources     Contact us    
Browse thread
camlp4 3.10 questions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Nicolas Pouillard <nicolas.pouillard@g...>
Subject: Re: [Caml-list] camlp4 3.10 questions
On 3/29/07, Hendrik Tews <H.Tews@cs.ru.nl> wrote:
> "Nicolas Pouillard" <nicolas.pouillard@gmail.com> writes:
>
>    > 2. There are various maps and folds on asts in Sig.Camlp4Ast. How
>    >    can I use them?
>
>    2/ There is a lot of shortcuts to made the use of them easier when one
>    just want to hook up only one thing (expressions for instance).
>
>    The same example.
>
>    open Camlp4.PreCast
>    let f = Ast.map_expr begin function
>        | <:expr< $x$ + 0 >> | <:expr< 0 + $x$ >> -> x
>        | e -> e
>    end in
>    AstFilters.register_str_item f#str_item
>
> That should be  AstFilters.register_str_item f ?

Nop, giving the up to date signature of Ast.map_exp:

value map_expr : (expr -> expr) -> map;

A map value is an object that waits for a starting order.

f#str_item <:str_item< ... >>;

f#expr <:expr< ... >>;

...

Since AstFilters.register_str_item waits for a (str_item -> str_item)
function I give it f#str_item.

>    > 8. How can I process multiple files with the same camlp4 process?
>
>    As always ?
>
> How is as always? Two files on the command line give the usage
> info:
>
>     camlp4o printer.cmo test.ml printer.ml
>     Usage: camlp4 [load-options] [--] [other-options]
>     Options:
>         ....

You're right only one file (implem or interf).
So you can't by command line.

-- 
Nicolas Pouillard