comp.lang.ada
 help / color / mirror / Atom feed
* How compiler finds files ?
@ 1998-02-04  0:00 Guest
  1998-02-04  0:00 ` Tucker Taft
  0 siblings, 1 reply; 6+ messages in thread
From: Guest @ 1998-02-04  0:00 UTC (permalink / raw)



Hi,

(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:
1. What Ada programming environment you work with;
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).
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) ?

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.

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




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How compiler finds files ?
  1998-02-04  0:00 How compiler finds files ? Guest
@ 1998-02-04  0:00 ` Tucker Taft
  1998-02-04  0:00   ` Robert Dewar
  1998-02-04  0:00   ` Robert Dewar
  0 siblings, 2 replies; 6+ messages in thread
From: Tucker Taft @ 1998-02-04  0:00 UTC (permalink / raw)



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




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How compiler finds files ?
  1998-02-04  0:00 ` Tucker Taft
@ 1998-02-04  0:00   ` Robert Dewar
  1998-02-09  0:00     ` vonhend
  1998-02-04  0:00   ` Robert Dewar
  1 sibling, 1 reply; 6+ messages in thread
From: Robert Dewar @ 1998-02-04  0:00 UTC (permalink / raw)



guest@xperts.hu wrote

<<: 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) ?
>>

There is no such requirement. This is simply the default, but it can be
overridden using a configuration pragma in the gnat.adc, which acts much
like the unit map that Tuck described.

Time for me to once again say. If you are using GNAT, it is a remarkably
good idea to read the GNAT manuals, you might learn all sorts of useful
stuff :-)

Robert Dewar
Ada Core Technologies





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How compiler finds files ?
  1998-02-04  0:00 ` Tucker Taft
  1998-02-04  0:00   ` Robert Dewar
@ 1998-02-04  0:00   ` Robert Dewar
  1 sibling, 0 replies; 6+ messages in thread
From: Robert Dewar @ 1998-02-04  0:00 UTC (permalink / raw)



guest@xpert.gu asks

<<: 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.
>>

Wouldn't it make more sense to investigate ASIS as the environment for
solving your problem. It sounds like you are trying to recreate a
substantial part of an Ada compiler. Why bother? When you can use the
capabilities of an existing compiler via the ASIS interface.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How compiler finds files ?
  1998-02-04  0:00   ` Robert Dewar
@ 1998-02-09  0:00     ` vonhend
  1998-02-09  0:00       ` Robert Dewar
  0 siblings, 1 reply; 6+ messages in thread
From: vonhend @ 1998-02-09  0:00 UTC (permalink / raw)



In <dewar.886613326@merv>, dewar@merv.cs.nyu.edu (Robert Dewar) writes:
>guest@xperts.hu wrote
>
>Time for me to once again say. If you are using GNAT, it is a remarkably
>good idea to read the GNAT manuals, you might learn all sorts of useful
>stuff :-)
>
>Robert Dewar
>Ada Core Technologies
>

Oh, no, Mr. Dewar.  This kind of activity is to be performed only as a last
resort, when all other avenues of inquiry have failed. ;)

M. Von Hendy
LMTO





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How compiler finds files ?
  1998-02-09  0:00     ` vonhend
@ 1998-02-09  0:00       ` Robert Dewar
  0 siblings, 0 replies; 6+ messages in thread
From: Robert Dewar @ 1998-02-09  0:00 UTC (permalink / raw)




vonhend@ibm.com says

<<Oh, no, Mr. Dewar.  This kind of activity is to be performed only as a last
resort, when all other avenues of inquiry have failed. ;)
>>

The sad thing is that the above most definitely needs the smiley that came
with it, because all too many people do indeed follow this advice (the
activity in question was reading the manuals). All too often these days,
students fire off a massively cross-posted message asking a question,
hoping for a reply (and not only students for that matter). The trouble
is that given the population of the newsgroups these days, the result
is all too often the blind leading the blind into a blind alley!





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1998-02-09  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-04  0:00 How compiler finds files ? Guest
1998-02-04  0:00 ` Tucker Taft
1998-02-04  0:00   ` Robert Dewar
1998-02-09  0:00     ` vonhend
1998-02-09  0:00       ` Robert Dewar
1998-02-04  0:00   ` Robert Dewar

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