[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ 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 <jake@donham.org> wrote: > On Tue, Sep 28, 2010 at 6:13 AM, Dmitry Bely <dmitry.bely@gmail.com> 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: > > http://www.ocaml.info/home/ocaml_sources.html#toc9 > > 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