Browse thread
Pattern-matching destructors ?
-
David Teller
- Alain Frisch
-
Jean-Christophe
- David Teller
- Jon Harrop
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | David Teller <David.Teller@u...> |
| Subject: | Re: [Caml-list] Pattern-matching destructors ? |
On Tue, 2007-10-16 at 19:44 +0200, Jean-Christophe wrote: > David Teller a écrit : > > > > I'm currently working on static analysis of JavaScript 2. For this, I > > need to keep lots of informations in each node of my AST, including > > things such as line/column (for better error messages), unique > > identifier (for storing inferred information), etc. As things progress, > > I fear that the number of such informations is growing prohibitive and > > very much getting into the way of pattern-matching. > > I don't see why a lot of information in AST nodes is getting into the > way of pattern-matching. Okay, it is possible to write it in a rather concise manner. But it still exposes somewhat too much information for my taste. I'll look at Martin's camlp4 extension. > When decorating ASTs, you basically replace a > type definition such as > > type t = > | A > | B of b > | C of string * t * t > | D of t list > > by two mutual recursive types Well, I actually have about 15 recursive types, which does make it somewhat more difficult, in part because my records need to have different field names. Now, I guess I can just parametrize your second type t upon t_node. Thanks for the answers, David -- David Teller ------------------------------------------ Security of Distributed Systems ----------------------- Project JStify: Static Analysis for JavaScript 2 ----- -- http://www.univ-orleans.fr/lifo/Members/David.Teller ----- Laboratoire d'Informatique Fondamentale d'Orleans