Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] handling forward references in a compiler
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Evan Martin <martine@d...>
Subject: Re: [Caml-list] handling forward references in a compiler
On Tue, May 25, 2004 at 05:52:13PM +0800, dido@imperium.ph wrote:
> I'm writing a compiler for a language that allows undeclared forward
> references in OCaml, and I'm just wondering how one is supposed to
> handle these sorts of things without resorting to imperative features or
> multiple passes.

Thanks for asking this question.  I'm actually stuck on almost the same
problem right now.  I resorted to doing both:  filling out hash tables
in an initial pass.  I figure that the global namespace is not
dynamic--in contrast with locally-scoped bindings--so it's ok to use it
imperatively; I never need any version of it except for the final one.
In other words, there's only one full, accurate picture of the global
namespace (while the local bindings vary from scope to scope), so I
might as well take a pass to figure it out completely.

But I'm eager to read what others have to say.

-- 
Evan Martin
martine@danga.com
http://neugierig.org

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners