caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Dmitry Bely <dmitry.bely@gmail.com>
To: Jake Donham <jake@donham.org>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Chain Camlp4 syntax extensions?
Date: Tue, 28 Sep 2010 20:55:00 +0400	[thread overview]
Message-ID: <AANLkTi=S5tU-3QWDAWzKsm3w+bYqBx7ou4+P=EFoz9CX@mail.gmail.com> (raw)
In-Reply-To: <AANLkTinb-hAou9siV7nOpa67pDuy6Q0Zb0mTS6-ZODK7@mail.gmail.com>

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


  reply	other threads:[~2010-09-28 16:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-28 13:13 Dmitry Bely
2010-09-28 16:07 ` [Caml-list] " Jake Donham
2010-09-28 16:55   ` Dmitry Bely [this message]
2010-09-29  8:27 ` Hendrik Tews

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTi=S5tU-3QWDAWzKsm3w+bYqBx7ou4+P=EFoz9CX@mail.gmail.com' \
    --to=dmitry.bely@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=jake@donham.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).