comp.lang.ada
 help / color / mirror / Atom feed
From: stt@houdini.camb.inmet.com (Tucker Taft)
Subject: Re: How compiler finds files ?
Date: 1998/02/04
Date: 1998-02-04T00:00:00+00:00	[thread overview]
Message-ID: <Env12y.Lz7.0.-s@inmet.camb.inmet.com> (raw)
In-Reply-To: 34D83BB5.4992@xperts.hu


Guest (guest@xperts.hu) wrote:

: (I have already put a very similar question up before, and received
: satisfactory answers from many people - thank you all. Unfortunately,
: that information could not help me overcoming all of my problems.)

: Would you please email me (gvarga@xperts.hu) the following information:

(I will e-mail this reply as well)

: 1. What Ada programming environment you work with;

Aonix, Green Hills, AppletMagic (Ada -> Java byte codes), etc.

: 2. In your environment, how "package-name resolution" works (Upon
: finding a "WITH PKG_NAME;" statement, how your compiler determines the
: file name in which PKG_NAME specification is located).

There is a file called "UNIT.MAP" in each program library which
keeps track of the mapping between Ada source files and Ada
compilation units.  This file is built up as a side-effect of
running the compiler, or a separate "registration" tool.

The registration tool includes a very fast "loose" parser 
designed for determining which compilation units are present
in a given source file, without bothering with any semantic
analysis or error checking.  

If requested, the compiler will automatically invoke the 
registration tool if the UNIT.MAP does not include a desired
compilation unit, in a mode where it scans a whole directory of 
source files for the compilation unit of interest.
This allows the user to avoid "preregistering" source files should
they so desire.

Note that your term "package-name resolution" is a bit misleading.
You might better call it "locating compilation units."

: 3. Is there a restriction of file name extensions in your environment
: (e.g. as GNU Ada requires package specifications to be in .ads files) ?

No.  Source files may have any name whatsoever, and may be in any
directory whatsoever.  Source files may contain multiple 
compilation units if desired.  Note that GNAT (aka GNU Ada) 
now has a pragma-based mechanism for supporting arbitrary 
source file names, but at the current time does require that each 
source file contain only a single compilation unit.

: I'm working on an Ada parser, which has to do package-name resolution.
: As far as I know, there is no standard way of that. However, I want to
: make my parser to be as generic as possible, and be able to work in many
: environments. I collect this information to obtain an view of today's
: Ada environments.

I hope you have a lot of patience.  It looks like you are trying
to do more than just parse Ada, and in fact are trying to do some
amount of what is traditionally called "semantic" analysis.
This is not a small job, for Ada95, or almost any other modern
programming language.

: Thank you (I hope it wasn't too long),
: Gabor

--
-Tucker Taft   stt@inmet.com   http://www.inmet.com/~stt/
Intermetrics, Inc.  Burlington, MA  USA




  reply	other threads:[~1998-02-04  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-02-04  0:00 How compiler finds files ? Guest
1998-02-04  0:00 ` Tucker Taft [this message]
1998-02-04  0:00   ` Robert Dewar
1998-02-04  0:00   ` Robert Dewar
1998-02-09  0:00     ` vonhend
1998-02-09  0:00       ` Robert Dewar
replies disabled

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