caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Dmitry Lomov <dmitry.lomov@jetbrains.com>
To: ocaml ml <caml-list@inria.fr>
Cc: Pietro Abate <Pietro.Abate@anu.edu.au>
Subject: Re: [Caml-list] camlp4 question...
Date: Tue, 05 Oct 2004 09:38:47 +0400	[thread overview]
Message-ID: <41623367.9060504@jetbrains.com> (raw)
In-Reply-To: <20041005034509.GA12748@pulp.anu.edu.au>

Pietro Abate wrote:

> Hi all,
> 
> I'd like to write a small extension to transform 
> 
> let f <a;b;c> = ...
> 
> in 
> 
> let f new_id =
> 	match new_id with
> 	|[a;b;c] -> ...
> 	|_ -> failwith "wrong arguments"
> 
> I've tried with something like:
>         expr: LEVEL "simple"
>         [[
>             "let"; OPT "rec"; "<"; l = LIST1 LIDENT; ">"; $list:pel$ "in" e = expr ->
>                 <:expr< let .... = function [] -> failwith "ffff" | $list:l$ -> $e$ >>
>         ]];
> 
> but I'm stuck... In particular, how can I parse $list:pel$ ?
> pel = LIST patt ?

Do check your syntax once again. $list:pel$ is an antiquotation, and not 
a parsing rule. As such, it cannot appear to the left of '->'.
The LHS should look about like that:

expr: LEVEL "let" (* sic! *)
[[ "let"; OPT "rec"; LIDENT; "<"; LIST patt; ">";"=";
      expr;"in" expr -> ....
]]

RHS should be quite straightforward (you should bind subparsing results, 
of course)

HTH,
Friendly,
Dmitry

-- 
Dmitry Lomov
JetBrains Inc.
http://www.jetbrains.com
"Develop With Pleasure!"

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2004-10-05  5:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-05  3:45 Pietro Abate
2004-10-05  5:38 ` Dmitry Lomov [this message]
2005-09-08  8:02 Christophe Raffalli
2005-09-08 17:41 ` [Caml-list] " Martin Jambon
2005-10-28 19:44 Camlp4 question Matt Gushee
2005-11-01 14:04 ` [Caml-list] " Hendrik Tews
2005-11-30  9:29 camlp4 question Christophe Raffalli
2005-12-01  9:13 ` [Caml-list] " 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=41623367.9060504@jetbrains.com \
    --to=dmitry.lomov@jetbrains.com \
    --cc=Pietro.Abate@anu.edu.au \
    --cc=caml-list@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).