home *** CD-ROM | disk | FTP | other *** search
Wrap
<COMMENT This is a lesson file for the Lovelace Ada tutorial> <COMMENT A program called genlesson is used to transform this file into a set> <COMMENT of useful HTML files for use by Mosaic & other WWW browsers.> <COMMENT Edit the following lines. > <TUTOR NAME="Lovelace"> <LESSON NUMBER=14> <AUTHOR NAME="David A. Wheeler" EMAIL="wheeler@ida.org"> <AUTHOR ADDRESS="<A HREF="dwheeler.htm">David A. Wheeler (wheeler@ida.org)</A>"> <COMMENT $Id: lesson14.les,v 1.4 1995/08/09 21:07:40 wheeler Exp $ > <COMMENT You'll probably want to uncomment and edit these lines: > <COMMENT <PREVIOUS_LESSON LOCATION="URL_of_directory/" > <COMMENT <NEXT_LESSON LOCATION="URL_of_directory/" > <COMMENT A lesson is divided into 1 or more "sections".> <COMMENT Each section has a title; SECTION starts a new section.> <SECTION NAME="Key Ada-Related Documents"> There are a few key Ada-related documents that you should know about: <UL> <LI>The most important document is the Ada <EM>Language Reference Manual (LRM)</EM>, which has been referred to throughout this tutorial. The Ada LRM is like a legal contract between a user of the Ada language and an Ada compiler developer; it defines the rights and responsibilities of each party. <LI><EM>Ada Quality and Style: Guidelines for Professional Programmers</EM> (AQ&S) provides a set of specific guidelines to help developers produce better Ada programs. Basically it's the distilled experience of other Ada users; most Ada developers use it. The AQ&S was developed by the Software Productivity Consortium (SPC). <LI>The <EM>Ada Rationale</EM> is a document that explains why Ada is designed the way it is. <LI>The <EM>Annotated Ada Reference Manual (AARM)</EM> is an extended version of the LRM. The AARM is simply the LRM with a large number of additional notes in each section on the ramifications and implications of every part. The AARM is used mostly by compiler vendors. </UL> <P> <A HREF="http://lglwww.epfl.ch/Ada/Resources/References.html">All of these reference documents are available electronically</A>. <QUESTION Type=Multiple-Choice> Which document is a set of guidelines to help you develop better Ada programs? <CHOICES> <CHOICE ANS=1>LRM. <CHOICE ANS=2>AARM <CHOICE ANS=3>AQ&S </CHOICES> <ANSWER ANS=3> <RESPONSES> <WHEN ANS=1> No, sorry. The LRM does include some guidelines and hints, but that's not its main purpose. <WHEN ANS=2> No, sorry. The AARM does include some guidelines and hints, but that's not its main purpose. <WHEN ANS=3> Right. It'd be a good idea to skim through the AQ&S before you write a lot of Ada code. </RESPONSES> <SECTION NAME="LRM Structure"> Since the LRM is the single most important Ada document, it's important to understand that document's structure. The LRM contains thirteen sections (numbered 1 through 13), fourteen annexes (labelled A through P), and an index. It also has an introduction which briefly describes the Ada language as a whole. <P> All true Ada compilers are required to implement the ``core Ada language''. The core of the Ada language is defined in the sections (1 through 13) and three of the document's annexes: <UL> <LI> Annex A, ``Predefined Language Environment'' <LI> Annex B, ``Interface to Other Languages'' <LI> Annex J, ``Obsolescent Features'' </UL> <P> Here are the thirteen sections of the LRM, with a simplified description of what is in each section: <P> <OL> <LI>General - introduces the standard and defines some basic terms. <LI>Lexical Elements - what are keywords, identifiers, and number syntax. <LI>Declarations and Types - how to declare types, constants, variables, and named numbers. <LI>Names and Expressions - what are legal expressions and uses of types. <LI>Statements - statement syntax (if, loop, etc.) <LI>Subprograms - how to declare and define subprograms (procedures and functions) <LI>Packages - how to declare and define packages <LI>Visibility Rules - scoping rules, use clauses <LI>Tasks and Synchronization - all about tasks and protected types/objects <LI>Program Structure and Compilation Issues - how to compile programs, "with" clauses <LI>Exceptions - all about exceptions <LI>Generic Units - all about generics <LI>Representation Issues - all about low-level requests (requiring records to be stored in certain formats, bit lengths of variables, and so on). </OL> <P> Ada compilers may also include features needed by certain application areas, which are defined in some of the other annexes. These are called the "specialized needs annexes", and are defined in annexes C through H. For example, annex G defines additional requirements and support packages for numerical work, and annex H defines additional support for safety and security. A given Ada compiler may support none or a selected set of these annexes. <P> Both the index and the table of contents may help you find a specific issue you're trying to find out about. Annex N is the glossary, which may help you understand a specific term used in the LRM. <P> LRM references are usually given in the form of the section number followed by the paragraph number, with the paragraph number in parentheses. Thus, if a compiler error message or someone's post to a newsgroup references LRM 7.1(3), they are referring to the third paragraph in section 7.1 (which gives the syntax for a package specification). <P> Is the LRM an easy document to read at first? No, not for most people; it's a lot like reading a legal document. However, it gets easier to do over time, and it's a useful skill. Once you are able to look up things in the LRM, you'll be able to answer authoritatively many Ada-related questions. <P> <A HREF="http://lglwww.epfl.ch/Ada/LRM/9X/rm9x/rm9x-toc.html">Magnus Kempe has developed a hypertext version of the Ada LRM.</A> It includes three ``zoom levels'' of the table of contents that you may find very useful. <QUESTION Type=Multiple-Choice> What section would give more information about protected objects? <CHOICES> <CHOICE ANS=1>Section 1. <CHOICE ANS=2>Section 5. <CHOICE ANS=3>Section 6. <CHOICE ANS=4>Section 9. <CHOICE ANS=5>Section 12. <CHOICE ANS=6>Section 13. </CHOICES> <ANSWER ANS=4> <SECTION NAME="On-Line Ada Information Sources"> If you're using Ada and have a question, there are a number of different resources available, depending on the kind of question you have. As we discussed earlier, <A HREF="http://lglwww.epfl.ch/Ada/LRM/9X/rm9x/rm9x-toc.html">the LRM is the authoritative book regarding Ada syntax.</A> Two other useful on-line sources for answers to common questions include: <UL> <LI> The <A HREF="http://lglwww.epfl.ch/Ada/FAQ/programming.html#title">"Ada Programmer Frequently-Asked Questions (FAQ)"</A> file. <LI> The <A HREF="http://lglwww.epfl.ch/Ada/FAQ/comp-lang-ada.html#title">comp.lang.ada newsgroup FAQ.</A> </UL> <P> Here are some of the more important Ada WWW servers that are good sources of Ada-related information: <OL> <LI> The Switzerland Ada WWW Server / Home of the Brave Ada Programmers (HBAP). One of the most popular Ada WWW servers is <A HREF="http://lglwww.epfl.ch/Ada/">Magnus Kempe's <EM>Home of the Brave Ada Programmers</EM> (HBAP)</A>, which is located in Lausanne, Switzerland. This server contains a number of Ada-related items, including this tutorial. <LI> Public Ada Library (PAL). The PAL is a library of Ada software, courseware, and documentation. <A HREF="http://wuarchive.wustl.edu/languages/ada/pal.html">The main PAL site is in the U.S. at wuarchive.wustl.edu (WUARCHIVE)</A>, and <A HREF="http://web.cnam.fr/Languages/Ada/PAL/">a French mirror site</A> is also available. <A HREF="http://wuarchive.wustl.edu/languages/ada/userdocs/html/cardcat/00_Tax.html">The PAL (subject) "card catalog" is an easy way to directly access the PAL data.</A> The PAL is currently managed by <A HREF="mailto:conn@wuarchive.wustl.edu">Richard Conn</A>. <LI> Ada Information Clearinghouse Home Page. <A HREF="http://sw-eng.falls-church.va.us/">The Ada Information Clearinghouse Home Page provides a collection of Ada-related information.</A> <LI> SIGAda WWW Home Page. <A HREF="http://info.acm.org/sigada/"> SIGAda, a Special Interest Group of the Association for Computing Machinery (ACM), maintains an Ada-related home page.</A> A number of working groups on specialized areas (such as numerics and real-time work) have information available through this server. </OL> <P> This list of servers is only a partial list; in particular there are a number of Ada software libraries. <A HREF="http://lglwww.epfl.ch/Ada/">The HBAP server has a list of other sources of Ada information</A>. <P> There are simple ways to answer simple syntax questions. A nice set of <A HREF="http://wuarchive.wustl.edu/languages/ada/userdocs/html/cardcat/refcards.html">Ada 95 reference cards have been developed by Paul Pukite</A>. Members of the Database Research Group at the University of Geneva have produced a very nice set of documents describing the <A HREF="http://cuiwww.unige.ch/db-research/Enseignement/analyseinfo/Ada95/BNFindex.html">syntax rules of Ada 95 illustrated by syntactic diagrams, with cross-references.</A> <P> If you're interested in a free Ada 95 compiler, look at GNAT; the <A HREF="http://cs.nyu.edu/cs/projects/gnat/">GNAT Project Home Page</A> has more information. <A HREF="ftp://ftp.gwu.edu/pub/ada/ez2load">"ez2load"</A> is a simple-to-install package of Ada-related products (including GNAT) for IBM-compatible PCs running MS-DOS or Microsoft Windows 3.1/95/NT. The HBAP server can point you to lists of <A HREF="http://lglwww.epfl.ch/Ada/Resources/Compilers/Compilers.html">Ada compilers</A>. If you're developing a program to analyze an Ada program, you may want to learn more about ASIS; the <A HREF="http://www.acm.org/sigada/WG/asiswg/asiswg.html">ASIS working group</A> page may be of interest to you. <P> Your next source for answers should be local experts or your compiler vendor. If you can, ask your local Ada guru at your company or university. If you have a compiler question, send your question to the compiler vendor. For example, GNAT bug reports should be addressed to <A HREF="mailto:gnat-report@cs.nyu.edu">gnat-report@cs.nyu.edu</A>. For bug reports to any compiler vendor, be sure to include the expected output, the actual output, the source code that causes the bug (simplified if possible), and the version number (GNAT reports this when given the -gnatv option). <P> If all these approaches fail, post your question to the <A HREF="news:comp.lang.ada">newsgroup comp.lang.ada</A>. As when posting to any other newsgroup, don't use inflammatory language, and include all the information necessary so others can understand your problem. In particular, state your question clearly, give the name and version number of your compiler, give the kind of computer and operating system you're running on, and include a simple example if that's relevant. <QUESTION Type=Multiple-Choice> What are the following: HBAP, PAL, GNAT, ez2load, comp.lang.ada? <CHOICES> <CHOICE ANS=1>The Switzerland Ada WWW server, a library of Ada components, a free Ada compiler, an easy-to-install set of Ada components for PC's, the Ada newsgroup. <CHOICE ANS=2>A library of Ada components, the Switzerland Ada WWW server, a free Ada compiler, an easy-to-install set of Ada components for PC's, the Ada newsgroup. <CHOICE ANS=3>A free Ada compiler, an easy-to-install set of Ada components for PC's, the Ada newsgroup, a library of Ada components, the Switzerland Ada WWW server. </CHOICES> <ANSWER ANS=1> <RESPONSES> <WHEN ANS=1> That's correct. I asked about the abbreviations because you'll sometimes see the abbreviations in posts to comp.lang.ada. </RESPONSES>