From: Martin Jambon <martin.jambon@ens-lyon.org>
To: Jonathan Bryant <jtbryant@valdosta.edu>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] CamlP4 and Threads
Date: Sat, 27 Jan 2007 20:12:59 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.64.0701272008260.4219@droopy> (raw)
In-Reply-To: <AA090139-6A74-406B-85CA-FC1FF5EF1BC9@valdosta.edu>
On Sat, 27 Jan 2007, Jonathan Bryant wrote:
> I'm think I'm finally understanding CamlP4 and I'm trying to make a small
> syntax extension using it, but I can't find the rule I need to extend. I
> want to turn this:
>
> let f x y x = ....
> let x = |f| x y z
>
> into this:
>
> let f x y z = ...
> let x =
> let c = Event.new_channel () in
> let _ = Thread.create (fun c -> let x = f x y z in Event.sync (Event.send c
> x)) in
> Event.receive c
>
> but, like I said, I can't seem to find the rule I need to extend. I can do
> it for an arbitrary expression:
>
> let x = |3 + 5|
>
> to
>
> let x =
> let c = Event.new_channel () in
> let _ = Thread.create (fun c -> let x = 3 + 5 in Event.sync (Event.send c
> x)) in
> Event.receive c
>
> just not function application.
>
> I've tried extending Pcaml.expr's "apply" but that doesn't seem to work, and
> I can't see any other place to do it.
You have to create a rule for your special function application, e.g.
"|"; f = expr; "|"; args = LIST0 expr LEVEL "." -> ...
Is it what you tried?
Martin
--
Martin Jambon
http://martin.jambon.free.fr
prev parent reply other threads:[~2007-01-28 4:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-27 23:21 Jonathan Bryant
2007-01-28 4:12 ` Martin Jambon [this message]
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=Pine.LNX.4.64.0701272008260.4219@droopy \
--to=martin.jambon@ens-lyon.org \
--cc=caml-list@yquem.inria.fr \
--cc=jtbryant@valdosta.edu \
/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).