comp.lang.ada
 help / color / mirror / Atom feed
From: fjh@cs.mu.oz.au (Fergus Henderson)
Subject: Re: Mutually dependent private types
Date: 1998/05/30
Date: 1998-05-30T00:00:00+00:00	[thread overview]
Message-ID: <6kp02d$of5$1@mulga.cs.mu.OZ.AU> (raw)
In-Reply-To: 356F8561.A863216A@acenet.com.au


Geoff Bull <gbull@acenet.com.au> writes:

>How does a compiler that uses a non source based compilation library
>"with" a package that hasn't been compiled yet?
>(i.e. would allowing circular dependencies introduce a big headache
>for just about every Ada compiler, except for Gnat?)

You can implement this by breaking up "compilation" into several
stages.  For example, the Mercury compiler (which supports a module
system similar to that of Ada) supports circular dependencies
with a non-source-based compilation library by breaking compilation
into the following stages:

	mmc --make-short-interface foo
		Does rudimentary syntax checking.
		Records the names of types defined in the module foo
		in the compilation database.
		Preconditions: none.

	mmc --make-interface foo
		Checks the interface for type correctness (i.e.
		checks that there are no undefined types, etc.).
		Records the interface of module foo in the compilation
		database.
		Preconditions: the "short interfaces" of all imported modules
		must have already been generated.

	mmc --compile foo
		Does full semantic checking.
		Generates object code for the module foo.
		Preconditions: the interfaces of all imported modules
		must have already been generated.

Actually our "compilation database" is just a subdirectory containing
plain ASCII files.  The above preconditions are recorded in dependency
files, and then we use a tool based on GNU Make to ensure that the
compiler is invoked with the appropriate options in the appropriate order.

Whether or not doing this kind of thing would be a "big headache" for
existing Ada compilers is another question -- that would depend a lot
on exactly how they were implemented.  But I thought that the other
Ada95 front-ends all used the same kind of source based model that GNAT
uses anyway.

--
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3        |     -- the last words of T. S. Garp.




  reply	other threads:[~1998-05-30  0:00 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-05-21  0:00 Mutually dependent private types adam
1998-05-21  0:00 ` Matthew Heaney
1998-05-22  0:00   ` John Volan
1998-05-22  0:00     ` Matthew Heaney
1998-05-26  0:00       ` Robert I. Eachus
1998-05-26  0:00         ` John Volan
1998-05-27  0:00           ` Jerry van Dijk
1998-05-29  0:00             ` John Volan
1998-05-27  0:00           ` Robert I. Eachus
1998-05-29  0:00             ` John Volan
1998-05-26  0:00       ` John Volan
1998-05-26  0:00         ` Matthew Heaney
1998-05-27  0:00           ` John Volan
1998-05-27  0:00             ` Matthew Heaney
1998-05-28  0:00               ` John Volan
1998-05-28  0:00                 ` Matthew Heaney
1998-05-29  0:00                   ` John Volan
1998-05-29  0:00                 ` Brian Rogoff
1998-05-29  0:00                   ` John Volan
1998-05-29  0:00                     ` Brian Rogoff
1998-05-29  0:00                       ` John Volan
1998-05-30  0:00                 ` Geoff Bull
1998-05-30  0:00                   ` Fergus Henderson [this message]
1998-06-01  0:00                     ` John Volan
1998-06-02  0:00                       ` Fergus Henderson
1998-06-04  0:00                       ` Robert Dewar
1998-05-21  0:00 ` John Volan
  -- strict thread matches above, loose matches on Subject: below --
1998-05-22  0:00 adam
1998-05-22  0:00 ` Brian Rogoff
1998-05-22  0:00 ` Matthew Heaney
1998-05-22  0:00 ` John Volan
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox