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.8 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 concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 47845BC0A for ; Wed, 6 Jun 2007 21:43:07 +0200 (CEST) Received: from ik-out-1112.google.com (ik-out-1112.google.com [66.249.90.180]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l56Jh6gA019876 for ; Wed, 6 Jun 2007 21:43:07 +0200 Received: by ik-out-1112.google.com with SMTP id b35so246667ika for ; Wed, 06 Jun 2007 12:43:06 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:subject:from:to:content-type:date:message-id:mime-version:x-mailer:content-transfer-encoding:sender; b=fJi4tfx1x0w2Tm2dYnCVklR/gR/hfd+FoNG7CNIwJe+uH/BBkKT/8IxxowOqxW131oOgrorrCK3yEXPKf5jBAwxHoMW2GyhH8sBM5MvCLGRRIqX73SY+K+HAERS/yzC5D2l9jjTgQXxlxOEYHuaE8eOZkgZqeJSlfEkp5mbdBfg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:subject:from:to:content-type:date:message-id:mime-version:x-mailer:content-transfer-encoding:sender; b=TjHQ7X1sr+CkTqVjGvSg06ri2d1KZZFh8tKyrxdORBUb8igmhhIvgyI258iNCpwdQpuDORrPL6YobRfPXtzAjEbvMPpLDFTTKfr8JRlirXaHKV+CXFYTr890o9BOD7nZ3k3jsRns2CRiJCAbYnvHV0p0D1xd1uDa9UhXfxEf7NY= Received: by 10.78.130.6 with SMTP id c6mr370122hud.1181158986431; Wed, 06 Jun 2007 12:43:06 -0700 (PDT) Received: from ?192.168.0.1? ( [82.246.197.195]) by mx.google.com with ESMTP id 6sm138558nfv.2007.06.06.12.43.04; Wed, 06 Jun 2007 12:43:05 -0700 (PDT) Subject: Labelling trees From: David Teller To: OCaml Content-Type: text/plain Date: Wed, 06 Jun 2007 21:43:02 +0200 Message-Id: <1181158983.9266.12.camel@Blefuscu> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit Sender: David Teller X-Miltered: at concorde with ID 46670E4A.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; univ-orleans:01 checker:01 syntax:01 annotations:01 checker:01 annotations:01 intuitively:01 functors:01 univ-orleans:01 lifo:01 d'orleans:01 corrupting:98 abstract:01 expression:02 expression:02 Hi everyone, I'm currently in the very first stages of writing down a prototype implementation of a type checker. At the moment, I'm looking for "the nicest" way of labelling my abstract syntax tree with type annotations -- without corrupting the AST at all, if possible. Say I have type my_expression = ESomeConstructor of ... | ESomeConstructor2 of ... | ESomeConstructor3 of my_function and my_function = FSomeConstructor ... A first idea would be to replace this structures with type 'a my_expression = ESomeConstructor of ... | ESomeConstructor2 of ... | ESomeConstructor3 of 'a my_function and 'a my_function = FSomeConstructor ... That would let me annotate instances of my_expression or my_function with informations of type 'a. However, this won't scale in case I decide that my static checker will need annotations of different types for my_expression and my_function. Of course, my AST is actually a tad more complex and would require about 15 type arguments, which I don't consider very nice. Intuitively, using functors will yield the same kind of half-satisfying results. Any suggestions ? Thanks, David -- David Teller ------------------------------------------ Security of Distributed Systems ----------------------- -- http://www.univ-orleans.fr/lifo/Members/David.Teller ----- Laboratoire d'Informatique Fondamentale d'Orleans