This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: Here's a module-dependency analyser
- From: Per Bothner <per at bothner dot com>
- To: Jocelyn Paine <popx at pop3 dot ifs dot org dot uk>
- Cc: kawa at sources dot redhat dot com
- Date: Thu, 15 Nov 2001 16:36:56 -0800
- Subject: Re: Here's a module-dependency analyser
- References: <Pine.LNX.4.10.10111151513420.4614-100000@pop3.ifs.org.uk>
Jocelyn Paine wrote:
>A nice thing about the javac command is that 'javac *.java' will analyse
>dependencies between all files and compile them in the correct dependency
>order.
>
Well, to be picky: It doesn't. Or at least Iassume it doesn't, because
if there
is a cycle of dependencies (which is common), there is no "correct
dependency order".
Instead it has to process each file in multiple passes: The first pass
collects the
definitions *provided* by a file.
Kawa does something similar, in that makes two passes of a "body" (i.e.
a list of definitions and statements as in the body of a function or
top-level of a file).
The first pass "scan" accumulates definitions; the second pass "rewrite"
uses the definitions from the first pass. This two-pass approach allows
us to handle mutually recursive definitions.
Kawa should do the same when compiling multiple files as it already does for
a single file. The first pass would now extend over *all* the files we
want to
compile, and we don't do any further processing until we've "scanned"
every file.
Nothing terribly difficult, but actually doing it is the rub. Until then
Jocelyn's
tool will be useful.
> It could no doubt be improved: doesn't handle cycles yet
To do that we need to do an initial "scan" of all files as I outlined.
--Per