From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id C60A2BC0B for ; Sun, 28 Jan 2007 05:13:09 +0100 (CET) Received: from out4.smtp.messagingengine.com (out4.smtp.messagingengine.com [66.111.4.28]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l0S4DFJp027567 for ; Sun, 28 Jan 2007 05:13:15 +0100 Received: from out1.internal (unknown [10.202.2.149]) by out1.messagingengine.com (Postfix) with ESMTP id 6FC1697066; Sat, 27 Jan 2007 23:13:08 -0500 (EST) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by out1.internal (MEProxy); Sat, 27 Jan 2007 23:13:08 -0500 X-Sasl-enc: jpIfW5EDlfAo8KADdMLkHhGaFdwKw3BKT6L8o49abher 1169957588 Received: from adsl-75-37-171-228.dsl.sndg02.sbcglobal.net (adsl-75-37-171-228.dsl.sndg02.sbcglobal.net [75.37.171.228]) by mail.messagingengine.com (Postfix) with ESMTP id D65691616E; Sat, 27 Jan 2007 23:13:07 -0500 (EST) Date: Sat, 27 Jan 2007 20:12:59 -0800 (PST) From: Martin Jambon X-X-Sender: martin@droopy To: Jonathan Bryant Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] CamlP4 and Threads In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Miltered: at concorde with ID 45BC22DB.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ens-lyon:01 camlp:01 threads:01 camlp:01 syntax:01 pcaml:01 expr:01 expr:01 2007,:98 arbitrary:01 wrote:01 caml-list:01 jambon:01 jambon:01 expression:02 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