From: "Stephen Weeks" <sweeks@sweeks.com>
To: "Niko Matsakis" <niko@alum.mit.edu>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Extracting common information
Date: Thu, 24 May 2007 10:23:27 -0400 [thread overview]
Message-ID: <604682010705240723v609af56eq13380ced449565c@mail.gmail.com> (raw)
In-Reply-To: <E7A015DC-1733-4752-BE63-78113DBA3D5B@alum.mit.edu>
> 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. Since these annotations will
> change between compiler passes,
I ran in to the same design problem when writing MLton. My solution was to use
lisp-style property lists, but with appropriate ML static typing. See
http://mlton.org/PropertyList
The essence of the solution is to use a dynamically extensible sum type. Each
tree node holds a list ref of values in the sum type. Each compiler pass builds
a new variant of the sum type and stores whatever it needs in the list.
next prev parent reply other threads:[~2007-05-24 14:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-24 11:04 Niko Matsakis
2007-05-24 11:31 ` [Caml-list] " Romain
2007-05-24 11:44 ` Bünzli Daniel
2007-05-24 14:09 ` skaller
2007-05-24 14:23 ` Stephen Weeks [this message]
2007-05-24 18:00 ` Peter Ilberg
2007-05-28 19:00 ` Niko Matsakis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=604682010705240723v609af56eq13380ced449565c@mail.gmail.com \
--to=sweeks@sweeks.com \
--cc=caml-list@yquem.inria.fr \
--cc=niko@alum.mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox