Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2004-05-25 (20:00)
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, 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

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: