Version française
Home     About     Download     Resources     Contact us    
Browse thread
Extracting common information
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Peter Ilberg <peter.ilberg@g...>
Subject: Re: [Caml-list] Extracting common information
On Thu, 24 May 2007, Niko Matsakis <niko@alum.mit.edu> 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