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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: David Teller <David.Teller@u...>
Subject: Labelling trees

   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