caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* How to achieve this camlp4 syntax extension
@ 2009-04-02 11:42 Conglun Yao
  2009-04-02 12:33 ` [Caml-list] " Jérémie Dimino
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Conglun Yao @ 2009-04-02 11:42 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-04-14  0:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-02 11:42 How to achieve this camlp4 syntax extension 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
2009-04-02 13:00 ` Zheng Li
2009-04-02 20:23   ` Conglun Yao
2009-04-14  0:24     ` [Caml-list] " Christophe TROESTLER

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).