caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Raphael Proust <raphlalou@gmail.com>
To: Jake Donham <jake@donham.org>
Cc: Nicolas Pouillard <nicolas.pouillard@gmail.com>,
	caml-list@yquem.inria.fr
Subject: Re: [Caml-list] [Camlp4] Quotation expander with OCaml syntax
Date: Tue, 27 Jul 2010 09:57:27 +0200	[thread overview]
Message-ID: <AANLkTikmuNhcNWJ-mUK7fkn=HZAod6yUDFbAZfBAvctf@mail.gmail.com> (raw)
In-Reply-To: <AANLkTimdnN-QBRhKJ2TOr_kb1+_dAsE8Ro7mMhRcdmWd@mail.gmail.com>

On Mon, Jul 26, 2010 at 6:30 PM, Jake Donham <jake@donham.org> wrote:
> On Mon, Jul 26, 2010 at 8:41 AM, Raphael Proust <raphlalou@gmail.com> wrote:
>> What I basically need is to get an AST with antiquotations and quotations being
>> special nodes. How is this achievable w/o reimplementing a whole grammar?
>
> There is already a special node for antiquotations, but not
> quotations; see below.
>
>> The alternative solution is to use raw strings, to find antiquotation marks, to
>> split the string and to reinject it in the different files. Is there a way to
>> keep precise _loc information this way?
>
> [...]
>
> I'm not sure what syntactic problems Nicolas suggests you would run
> into by reusing the existing parser and quotation mechanism. But it
> might be a bit hairy to implement. One issue is that you can't just
> drop antiquotations anywhere; where they can appear (and with what
> tag) is given by the parser. If you want to go in this direction, the
> place to start would be Camlp4QuotationCommon.ml, which implements
> OCaml AST quotations / antiquotations. You can see there that you can
> parse starting at arbitrary non-terminals, and you can filter the
> OCaml AST without a giant pattern match using the Ast.map object.

I'll read the Camlp4QuotationCommon source code and try to have something like
{:on{ f $y$ }} working. Thanks for the answer and thanks for the Camlp4 blog
post series, it helped me a lot to get the first version of my extension
working!



-- 
_______
Raphael


  reply	other threads:[~2010-07-27  7:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AANLkTikuoN4H0Hsx74JwW66J9jmtq+usDxtQPpYfSGbd@mail.gmail.com>
2010-07-26 14:41 ` Raphael Proust
2010-07-26 15:13   ` [Caml-list] " Nicolas Pouillard
2010-07-26 15:41     ` Joel Reymont
2010-07-26 16:05       ` Jake Donham
2010-07-26 15:41     ` Raphael Proust
2010-07-26 16:27       ` Nicolas Pouillard
2010-07-26 16:30       ` Jake Donham
2010-07-27  7:57         ` Raphael Proust [this message]
2010-07-26 20:08   ` bluestorm
2010-07-26 20:53     ` Raphael Proust
2010-07-27 13:22   ` Thomas.Gazagnaire
2010-07-27 14:38     ` Raphael Proust
2010-07-27 14:47     ` Vincent Balat

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='AANLkTikmuNhcNWJ-mUK7fkn=HZAod6yUDFbAZfBAvctf@mail.gmail.com' \
    --to=raphlalou@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=jake@donham.org \
    --cc=nicolas.pouillard@gmail.com \
    /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).