From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e250826c4638fa0c X-Google-Attributes: gid103376,public From: stt@houdini.camb.inmet.com (Tucker Taft) Subject: Re: How compiler finds files ? Date: 1998/02/04 Message-ID: #1/1 X-Deja-AN: 322009314 Sender: news@inmet.camb.inmet.com (USENET news) References: <34D83BB5.4992@xperts.hu> X-Nntp-Posting-Host: houdini.camb.inmet.com Organization: Intermetrics, Inc. Newsgroups: comp.lang.ada Date: 1998-02-04T00:00:00+00:00 List-Id: 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