On Tue, Sep 28, 2010 at 8:07 PM, Jake Donham <j...@donham.org> wrote: > On Tue, Sep 28, 2010 at 6:13 AM, Dmitry Bely <dmitry.b...@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 _______________________________________________ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs