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
Chain Camlp4 syntax extensions?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dmitry Bely <dmitry.bely@g...>
Subject: Re: [Caml-list] Chain Camlp4 syntax extensions?
On Tue, Sep 28, 2010 at 8:07 PM, Jake Donham <> wrote:
> On Tue, Sep 28, 2010 at 6:13 AM, Dmitry Bely <> wrote:
>> I have two similar syntax extension that generate some functions for
>> each type in the module:
>> EXTEND Gram
>>  str_item:
>>    [ [ "type"; tdl = LIST1 type_declaration SEP "and" ->
>>        ...
>> END;
> There is not a good solution without modifying the extensions; looking
> at the signature of the Grammar module, you can modify a grammar but
> not look up or call existing rules / actions.
> This problem of combining extensions for type-derived functions is the
> motivation for the type-conv framework:
> It's trivial to convert an extension to use type-conv.

Thanks. But I have not found any docs for type-conv package. Is there
any example demonstrating how to make Camlp4 grammar compatible with
type-conv framework?

>> And another question. For camlp5 it was possible to inject some code
>> into the beginning of the generated file
> It should be doable with a filter and a bool ref---inject the code
> into the first str_item then set the flag so you don't add it to the
> others.

Thanks again. Indeed this is the way to go.

- Dmitry Bely