caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Conglun Yao <yaoconglun@gmail.com>
To: David Teller <David.Teller@univ-orleans.fr>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] How to achieve this camlp4 syntax extension
Date: Thu, 2 Apr 2009 13:48:11 +0100	[thread overview]
Message-ID: <f7b50d2a0904020548n53fe65aau1306a75e4be50611@mail.gmail.com> (raw)
In-Reply-To: <1238676007.6207.1.camel@Blefuscu>

David and Jérémie,

Thanks for your guys quick response.

It seems I get idea how to achieve it.  pa_do and pa_open are useful!

It's a pity I viewed the code of pa_infix before, but never noticed it
was part of a project.

Conglun

On Thu, Apr 2, 2009 at 1:40 PM, David Teller
<David.Teller@univ-orleans.fr> wrote:
>   Hi,
>  I'm not going to quite answer your question yet -- I'd need to check
> the source of Camlp4 for this. However, I can point out that what you're
> trying to do looks very much like pa_open, by Alain Frisch.
>
> let _ = open M1.M2 in e
>
> will execute [e] using module [M1.M2].
>
> Cheers,
>  David
>
> On Thu, 2009-04-02 at 12:42 +0100, Conglun Yao wrote:
>> Dear all,
>>
>> I tried to achieve the following syntax extension, but failed.
>>
>> Add expression .[ ] after a module name, inside .[ ] I want to refer
>> to the specified module, like
>>
>> let _ = M1.M2.[ here is my syntax,  using M1.M2 module ]
>>
>> Here is my attempt (failed)
>>
>> EXTEND Gram
>>
>> GLOBAL: expr;
>>
>> expr: LEVEL "top"[
>> [ e1 = module_longident; ".";  "[";  (*t = test_syntax;*)  "]" ->
>>   <:expr< $id:e1$ test >>
>> ]];
>>
>> END
>>
>> Different kinds of error happened, when trying to use it.
>>
>> Even the ordinary expression:  List.length [1; 2;3 ],  failed.  'List'
>> is parsed as module_longident, try to match the rule I defined.
>>
>> Thanks for any help.
>>
>> Conglun
>>
>> _______________________________________________
>> 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
>>
>
>


  reply	other threads:[~2009-04-02 12:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-02 11:42 Conglun Yao
2009-04-02 12:33 ` [Caml-list] " Jérémie Dimino
2009-04-02 12:40 ` David Teller
2009-04-02 12:48   ` Conglun Yao [this message]
2009-04-02 13:00 ` Zheng Li
2009-04-02 20:23   ` Conglun Yao
2009-04-14  0:24     ` [Caml-list] " Christophe TROESTLER

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=f7b50d2a0904020548n53fe65aau1306a75e4be50611@mail.gmail.com \
    --to=yaoconglun@gmail.com \
    --cc=David.Teller@univ-orleans.fr \
    --cc=caml-list@yquem.inria.fr \
    /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).