This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Here's a module-dependency analyser


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




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]