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:
>
>    On 3/29/07, Hendrik Tews <H.Tews@cs.ru.nl> wrote:
>    >
>    > 1. What is the difference between Register.Printer and
>    >    Register.OCamlPrinter? I guess it boils down to the difference
>    >    between Sig.Syntax and Sig.Camlp4Syntax?
>
>    Yes it's mainly a difference about what your printer really needs. If
>    you use the camlp4 AST then you need a Sig.Camlp4Syntax as argument,
>    if it's not needed then you can use Sig.Syntax.
>
> Does this mean I have to use Camlp4Syntax and OCamlPrinter it I
> want to use quotations? Or do the quotations also work on
> Sig.Syntax?

You need Camlp4Syntax to use camlp4 quotations (like expr, patt, ctyp...).

>
>    > 3. Register.declare_dyn_module puts all modules in a queue
>    >    together with a function that contains some delayed side
>    >    effects. Where are these function called?
>
>    Camlp4Bin.ml
>
> Well, I was that far. But where in Camlp4Bin?

It's done trough Register.iter_and_take_callbacks in the function called main.

>    > 5. I saw Camlp4OCamlOriginalQuotationExpander, presumably this is
>    >    a quotation expander for quotations in original syntax. Is
>    >    this already complete?
>
>    Complete, not really but usable yes.
>
> Are there just corner cases missing or whole branches of the
> syntax?

Just corner cases, I hope.

>    >    What is camlp4prof?
>
>    A profiling toy.
>
> Well... profiling what?

There is a filter (called Camlp4Profiler) that adds to all functions
something like:

let f x y z = body

become:

let f x y z =
let () = Camlp4prof.count "f @ foo.ml line 42 ..." in body

Then the camlp4prof module store all these calls and writes
"camlp4_profiler.out" at exit.

Running the camlp4prof program dumps that file.

PS: For now that's just a toy.

Best regards,

-- 
Nicolas Pouillard