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=1.4 required=5.0 tests=SPF_NEUTRAL autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id D912EBC0A for ; Thu, 24 May 2007 20:00:38 +0200 (CEST) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.174]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l4OI0cTj000912 for ; Thu, 24 May 2007 20:00:38 +0200 Received: by ug-out-1314.google.com with SMTP id p27so554518ugc for ; Thu, 24 May 2007 11:00:38 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:date:to:subject:from:cc:content-type:mime-version:references:content-transfer-encoding:message-id:in-reply-to:user-agent; b=IzLr72c8LrW+6WHva6s7PCqpYOpK5TlDCRgZmLtJBUMCFc5fKDn7wkqC/ABl7SegzKj8ImCi2qqN/7Gg+R38spYAOWQS9SRm28ZFGUzXyE/O5UCZ8i9dHJAoMZ2jaQTV3O2f/k2HFQICok8Kj0JnWwSkmsnjj7cJ6mxLTqOkJww= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:date:to:subject:from:cc:content-type:mime-version:references:content-transfer-encoding:message-id:in-reply-to:user-agent; b=XfQ43im1kf+5fgjex13NTJet3eAnsdQer8QGHjwjaTznM1pVFcmr/7wEcL6CYpITDY1KQixT+1w+42YOrIBA4zRf1W18WImI91zep5LTWCZmvBP71rCUB9W9m9MVKLTArBpSCvcfP6aiLHU98Tm+Zwoy4+1CQrqQLuFdYFm1XmI= Received: by 10.67.118.8 with SMTP id v8mr2316918ugm.1180029638181; Thu, 24 May 2007 11:00:38 -0700 (PDT) Received: from tomato.amer.corp.natinst.com ( [130.164.65.187]) by mx.google.com with ESMTP id s1sm4082447uge.2007.05.24.11.00.35; Thu, 24 May 2007 11:00:36 -0700 (PDT) Date: Thu, 24 May 2007 13:00:28 -0500 To: "Niko Matsakis" Subject: Re: [Caml-list] Extracting common information From: "Peter Ilberg" Cc: caml-list@yquem.inria.fr Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 References: <604682010705240723v609af56eq13380ced449565c@mail.gmail.com> Content-Transfer-Encoding: 7bit Message-ID: In-Reply-To: <604682010705240723v609af56eq13380ced449565c@mail.gmail.com> User-Agent: Opera Mail/9.10 (Win32) X-j-chkmail-Score: MSGID : 4655D2C6.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 4655D2C6.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; compiler:01 ocaml:01 annotation:01 datatype:01 annotations:01 haskell:01 ocaml:01 2007,:98 alum:98 6.2:98 wrote:01 caml-list:01 simonpj:02 ast:02 ast:02 On Thu, 24 May 2007, Niko Matsakis wrote: > I am working on a simple compiler in Ocaml, and having some difficulty > settling on the best design for my AST. [...] > then I realized I would want to thread along some annotation to store > the types, line numbers, and things like that. Simon Peyton Jones and David Lester discuss some options for an AST datatype with annotations in section 6.2 (page 225) of "Implementing functional languages: a tutorial". (You might have to read chapter 1 for background info.) They use Haskell, but their solution should be relatively easy to port to Ocaml, if you decide to use it. You can find the book at: http://research.microsoft.com/~simonpj/Papers/pj-lester-book/ --- Peter