Ada compilation units are, at the lowest level, composed of a sequence of lexical elements. Lexical elements include identifiers (such as the name of a procedure), reserved words, and various punctuation marks. Reserved words include ``procedure'', ``package'', ``end'', ``if'', and so on.
Ada is a free-form language like Pascal, C, and C++; line breaks and spaces can go essentially wherever you like between lexical elements. If identifiers or keywords are next to each other, they must be explicitly separated by one or more spaces and/or end-of-line markers.
Ada is also case-insensitive; except for the contents of strings (which are inside quotes), upper and lower case keywords and identifiers are equivalent.
Ada as a language permits a great deal of freedom, but some consistency of capitalization and indentation are helpful for reading later. The style used in this tutorial is the style suggested in the Software Productivity Consortia's (SPC) Ada Quality and Style: A Guide to Professional Programmers (which is the recommended style guide by the Ada Joint Program Office). In this style keywords are in lower case, identifiers have initial capitals, and there is at most one statement per line. If an identifier has more than one word in it, each word should have an initial capital letter and the words should have underscores (``_'') between them.
From a compiler's point of view, are procedures 1 and 2 identical or not?
with Text_IO; procedure Hello is begin Text_IO.Put("This is a test!"); end Hello;
WITH TEXT_IO; PROCEDURE hello IS BeGiN TEXT_IO.put("This is a test!"); END hello;
|Go back to the previous section||Skip to the next section||Go up to lesson 3 outline|
David A. Wheeler (firstname.lastname@example.org)
The master copy of this file is at
The master copy of this file is at "http://www.adahome.com/Tutorials/Lovelace/s3s1.htm".