From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 D5EC7BB83 for ; Thu, 20 Jul 2006 01:27:22 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k6JNRM5U031477 for ; Thu, 20 Jul 2006 01:27:22 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id BAA23156 for ; Thu, 20 Jul 2006 01:27:19 +0200 (MET DST) Received: from hedwig1.umh.ac.be (hedwig2.umh.ac.be [193.190.193.73]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k6JNRFUN015819 for ; Thu, 20 Jul 2006 01:27:19 +0200 Received: from poincare.swapping.umh.ac.be (pri-010.umh.ac.be [10.101.0.10]) by hedwig1.umh.ac.be (8.13.6/8.13.6) with ESMTP id k6JNTGn31425508; Thu, 20 Jul 2006 01:29:17 +0200 Received: from localhost ([127.0.0.1]) by poincare.swapping.umh.ac.be with esmtp (Exim 4.62) (envelope-from ) id 1G3LRb-0001TP-E6; Thu, 20 Jul 2006 01:27:07 +0200 Date: Thu, 20 Jul 2006 01:27:06 +0200 (CEST) Message-Id: <20060720.012706.109316902.Christophe.Troestler@umh.ac.be> To: "O'Caml Mailing List" Subject: camlp4 & free variables From: Christophe TROESTLER X-Face: #2fb%mPx>rRL@4ff~TVgZ"<[:,oL"`TUEGK/[8/qb58~C>jR(x4A+v/n)7BgpEtIph_neoLKJBq0JBY9:}8v|j Organization: Universite de Mons-Hainaut (http://math.umh.ac.be/an/) X-Spook: Al-Qaeda Rule Psix enforcers Venezuela Jyllandsposten Maple Clinton Bosnia airframe Guan tanamo X-Blessing: Om Ah Hum Vajra Guru Pema Siddhi Hum X-Operating-System: Debian GNU/Linux (http://www.debian.org/) X-Mailer: Mew version 4.2.52 on Emacs 22.0.50 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.1 (www dot roaringpenguin dot com slash mimedefang) X-Miltered: at concorde with ID 44BEBFDA.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 44BEBFD3.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; camlp:01 christophe:01 troestler:01 christophe:01 troestler:01 umh:01 camlp:01 syntax:01 parser:01 ocaml:01 expression:01 expression:01 short:01 variables:02 variables:02 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 Hi, Is it possible to write a camlp4 syntax extension that "extract" the free variables of an expression? As an example, say I write FUNCTION(let z = x + 2 in x + 2 * y * x * z) and it becomes fun ~x ~y -> let z = x + 2 in x + 2 * y * x * z (of course I'd like good error reporting in case of an error in the expression). If it is not possible, what is the best way to build a tool that does that (short of writing a parser for the OCaml language)? Thanks, ChriS