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.9 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id E2EB7BC69 for ; Tue, 16 Oct 2007 20:53:46 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAPqlFEfAXQInh2dsb2JhbACOTgEBAQgKKYEn X-IronPort-AV: E=Sophos;i="4.21,284,1188770400"; d="scan'208";a="4610315" Received: from concorde.inria.fr ([192.93.2.39]) by mail3-smtp-sop.national.inria.fr with ESMTP; 16 Oct 2007 20:53:46 +0200 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l9GIrjKK023704 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Tue, 16 Oct 2007 20:53:46 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAPqlFEdC+Vyvlmdsb2JhbACOTgEBAQEHBAYREQeBJw X-IronPort-AV: E=Sophos;i="4.21,284,1188770400"; d="scan'208";a="4610311" Received: from ug-out-1314.google.com ([66.249.92.175]) by mail3-smtp-sop.national.inria.fr with ESMTP; 16 Oct 2007 20:53:40 +0200 Received: by ug-out-1314.google.com with SMTP id m3so126350ugc for ; Tue, 16 Oct 2007 11:53:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:subject:from:to:cc:in-reply-to:references:content-type:date:message-id:mime-version:x-mailer:content-transfer-encoding:sender; bh=Nx8nB2cg/+dXyht1wAaa7x4KAjmZoqvF1O9qY9yDMAw=; b=QCRAhT5rglbRi/M9uI+slYSmhfB3dNxdrDNb94gGVdZ5oUPYG8p+3gCgRqTtCS9mkQaPWm8yR411DyGpYB3PnLGtejZ6gqyV7QBS/KiR5qBMPgEWO1vlVW60WMv44XSxntsh9UeglAxfLbh0ZPOkPDg1rMi3la8R6OIQIpwoNPc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:subject:from:to:cc:in-reply-to:references:content-type:date:message-id:mime-version:x-mailer:content-transfer-encoding:sender; b=LYGiHCuXGn5b4g+bwzOaSkQZWGxIHn5+Rlj5f2rbUXPVVT7xGwU6ASK9uneahEy5hT/j+F7uKwfF3vSwXgUUDNaHEQAmxfEZsCWP2bTRqZjmQbyMtf8I1jc3Q7wQteR4hdXnBeSvKxZJMaQR9k8DyMj282wQwskv+qVK0xNcXX4= Received: by 10.67.30.6 with SMTP id h6mr9445740ugj.1192560818941; Tue, 16 Oct 2007 11:53:38 -0700 (PDT) Received: from ?192.168.0.1? ( [82.246.197.195]) by mx.google.com with ESMTPS id j2sm11665886mue.2007.10.16.11.53.36 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 16 Oct 2007 11:53:37 -0700 (PDT) Subject: Re: [Caml-list] Pattern-matching destructors ? From: David Teller To: Jean-Christophe Cc: OCaml In-Reply-To: <4714F87B.8040807@lri.fr> References: <1192548046.6061.18.camel@Blefuscu> <4714F87B.8040807@lri.fr> Content-Type: text/plain; charset=utf-8 Date: Tue, 16 Oct 2007 20:53:34 +0200 Message-Id: <1192560814.6368.20.camel@Blefuscu> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 8bit Sender: David Teller X-Miltered: at concorde with ID 471508B9.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; univ-orleans:01 0200,:01 node:01 nodes:01 camlp:01 recursive:01 recursive:01 parametrize:01 node:01 univ-orleans:01 lifo:01 d'orleans:01 javascript:98 javascript:98 wrote:01 On Tue, 2007-10-16 at 19:44 +0200, Jean-Christophe wrote: > David Teller a écrit : > > > > I'm currently working on static analysis of JavaScript 2. For this, I > > need to keep lots of informations in each node of my AST, including > > things such as line/column (for better error messages), unique > > identifier (for storing inferred information), etc. As things progress, > > I fear that the number of such informations is growing prohibitive and > > very much getting into the way of pattern-matching. > > I don't see why a lot of information in AST nodes is getting into the > way of pattern-matching. Okay, it is possible to write it in a rather concise manner. But it still exposes somewhat too much information for my taste. I'll look at Martin's camlp4 extension. > When decorating ASTs, you basically replace a > type definition such as > > type t = > | A > | B of b > | C of string * t * t > | D of t list > > by two mutual recursive types Well, I actually have about 15 recursive types, which does make it somewhat more difficult, in part because my records need to have different field names. Now, I guess I can just parametrize your second type t upon t_node. Thanks for the answers, David -- David Teller ------------------------------------------ Security of Distributed Systems ----------------------- Project JStify: Static Analysis for JavaScript 2 ----- -- http://www.univ-orleans.fr/lifo/Members/David.Teller ----- Laboratoire d'Informatique Fondamentale d'Orleans