caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Labelling trees
@ 2007-06-06 19:43 David Teller
  2007-06-06 21:22 ` [Caml-list] " Christophe Raffalli
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: David Teller @ 2007-06-06 19:43 UTC (permalink / raw)
  To: OCaml


   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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-06-08 10:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-06 19:43 Labelling trees David Teller
2007-06-06 21:22 ` [Caml-list] " Christophe Raffalli
2007-06-07  1:00 ` skaller
2007-06-07 14:26   ` Till Varoquaux
2007-06-07 23:09     ` skaller
2007-06-08  9:52       ` Till Varoquaux
2007-06-08 10:32         ` skaller
2007-06-07 14:25 ` Christian Stork
2007-06-07 23:48 ` Jeremy Yallop

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).