1.1.2 Structure

9
Jan

1.1.2 Structure

1 This International Standard contains thirteen sections, fourteen annexes, and an index.

2 {core language} The core of the Ada language consists of: 

  • 3 Sections 1 through 13
  • 4 Annex A, “Predefined Language Environment”
  • 5 Annex B, “Interface to Other Languages”
  • 6 Annex J, “Obsolescent Features” 

7 {Specialized Needs Annexes} {Annex (Specialized Needs)} {application areas} The following Specialized Needs Annexes define features that are needed by certain application areas:

  • 8 Annex C, “Systems Programming”
  • 9 Annex D, “Real-Time Systems”
  • 10 Annex E, “Distributed Systems”
  • 11 Annex F, “Information Systems”
  • 12 Annex G, “Numerics”
  • 13 Annex H, “High Integrity Systems” 

14 {normative} {Annex (normative)} The core language and the Specialized Needs Annexes are normative, except that the material in each of the items listed below is informative: 

  • 15 Text under a NOTES or Examples heading.
  • 16 Each clause or subclause whose title starts with the word “Example” or “Examples”.

17 All implementations shall conform to the core language. In addition, an implementation may conform separately to one or more Specialized Needs Annexes.

18 {informative} {non-normative: See informative} {Annex (informative)} The following Annexes are informative: 

  • 19 Annex K, “Language-Defined Attributes”
  • 20 Annex L, “Language-Defined Pragmas”
  • 21 M.2, “Implementation-Defined Characteristics”
  • 22 Annex N, “Glossary
  • 23 Annex P, “Syntax Summary” 

23.a Discussion: The idea of the Specialized Needs Annexes is that implementations can choose to target certain application areas. For example, an implementation specifically targeted to embedded machines might support the application-specific features for Real-time Systems, but not the application-specific features for Information Systems.

23.b The Specialized Needs Annexes extend the core language only in ways that users, implementations, and standards bodies are allowed to extend the language; for example, via additional library units, attributes, representation items (see 13.1), pragmas, and constraints on semantic details that are left unspecified by the core language. Many implementations already provide much of the functionality defined by Specialized Needs Annexes; our goal is to increase uniformity among implementations by defining standard ways of providing the functionality.

23.c/2 {AI95-00114-01} We recommend that the certification procedures allow implementations to certify the core language, plus any set of the Specialized Needs Annexes. We recommend that implementations not be allowed to certify a portion of one of the Specialized Needs Annexes, although implementations can, of course, provide uncertified unvalidated support for such portions. We have designed the Specialized Needs Annexes assuming that this recommendation is followed. Thus, our decisions about what to include and what not to include in those annexes are based on the assumption that each annex is certified in an “all-or-nothing” manner.

23.d An implementation may, of course, support extensions that are different from (but possibly related to) those defined by one of the Specialized Needs Annexes. We recommend that, where appropriate, implementations do this by adding library units that are children of existing language-defined library packages.

23.e An implementation should not provide extensions that conflict with those defined in the Specialized Needs Annexes, in the following sense: Suppose an implementation supports a certain error-free program that uses only functionality defined in the core and in the Specialized Needs Annexes. The implementation should ensure that that program will still be error free in some possible full implementation of all of the Specialized Needs Annexes, and that the semantics of the program will not change. For example, an implementation should not provide a package with the same name as one defined in one of the Specialized Needs Annexes, but that behaves differently, even if that implementation does not claim conformance to that Annex.

23.f Note that the Specialized Needs Annexes do not conflict with each other; it is the intent that a single implementation can conform to all of them. 

24 Each section is divided into clauses and subclauses that have a common structure. Each section, clause, and subclause first introduces its subject. After the introductory text, text is labeled with the following headings: 

Language Design Principles

24.a These are not rules of the language, but guiding principles or goals used in defining the rules of the language. In some cases, the goal is only partially met; such cases are explained.

24.b/2 This is not part of the definition of the language, and does not appear in the Ada 2005 RM.

Syntax

25 {syntax (under Syntax heading)} {grammar (under Syntax heading)} {context free grammar (under Syntax heading)} {BNF (Backus-Naur Form) (under Syntax heading)} {Backus-Naur Form (BNF) (under Syntax heading)} Syntax rules (indented). 

Name Resolution Rules

26 {name resolution rules} {overloading rules} {resolution rules} Compile-time rules that are used in name resolution, including overload resolution. 

26.a Discussion: These rules are observed at compile time. (We say “observed” rather than “checked,” because these rules are not individually checked. They are really just part of the Legality Rules in Section 8 that require exactly one interpretation of each constituent of a complete context.) The only rules used in overload resolution are the Syntax Rules and the Name Resolution Rules.

26.b When dealing with non-overloadable declarations it sometimes makes no semantic difference whether a given rule is a Name Resolution Rule or a Legality Rule, and it is sometimes difficult to decide which it should be. We generally make a given rule a Name Resolution Rule only if it has to be. For example, “The name, if any, in a raise_statement shall be the name of an exception.” is under “Legality Rules.” 

Legality Rules

27 {legality rules} {compile-time error} {error (compile-time)} Rules that are enforced at compile time. {legal (construct)} {illegal (construct)} A construct is legal if it obeys all of the Legality Rules. 

27.a Discussion: These rules are not used in overload resolution.

27.b Note that run-time errors are always attached to exceptions; for example, it is not “illegal” to divide by zero, it just raises an exception. 

Static Semantics

28 {static semantics} {compile-time semantics} A definition of the compile-time effect of each construct.

28.a Discussion: The most important compile-time effects represent the effects on the symbol table associated with declarations (implicit or explicit). In addition, we use this heading as a bit of a grab bag for equivalences, package specifications, etc. For example, this is where we put statements like so-and-so is equivalent to such-and-such. (We ought to try to really mean it when we say such things!) Similarly, statements about magically-generated implicit declarations go here. These rules are generally written as statements of fact about the semantics, rather than as a you-shall-do-such-and-such sort of thing. 

Post-Compilation Rules

29 {post-compilation error} {post-compilation rules} {link-time error: See post-compilation error} {error (link-time)} Rules that are enforced before running a partition. {legal (partition)} {illegal (partition)} A partition is legal if its compilation units are legal and it obeys all of the Post-Compilation Rules. 

29.a Discussion: It is not specified exactly when these rules are checked, so long as they are checked for any given partition before that partition starts running. An implementation may choose to check some such rules at compile time, and reject compilation_units accordingly. Alternatively, an implementation may check such rules when the partition is created (usually known as “link time”), or when the partition is mapped to a particular piece of hardware (but before the partition starts running). 

Dynamic Semantics

30 {dynamic semantics} {run-time semantics} {run-time error} {error (run-time)} A definition of the run-time effect of each construct.

30.a Discussion: This heading describes what happens at run time. Run-time checks, which raise exceptions upon failure, are described here. Each item that involves a run-time check is marked with the name of the check — these are the same check names that are used in a pragma Suppress. Principle: Every check should have a name, usable in a pragma Suppress. 

Bounded (Run-Time) Errors

31 {bounded error} Situations that result in bounded (run-time) errors (see 1.1.5). 

31.a Discussion: The “bounds” of each such error are described here — that is, we characterize the set of all possible behaviors that can result from a bounded error occurring at run time. 

Erroneous Execution

32 {erroneous execution} Situations that result in erroneous execution (see 1.1.5). 

Implementation Requirements

33 {implementation requirements} Additional requirements for conforming implementations.

33.a Discussion: ...as opposed to rules imposed on the programmer. An example might be, “The smallest representable duration, Duration'Small, shall not be greater than twenty milliseconds.”

33.b It's really just an issue of how the rule is worded. We could write the same rule as “The smallest representable duration is an implementation-defined value less than or equal to 20 milliseconds” and then it would be under “Static Semantics.”

Documentation Requirements

34 {documentation requirements} Documentation requirements for conforming implementations.

34.a Discussion: These requirements are beyond those that are implicitly specified by the phrase “implementation defined”. The latter require documentation as well, but we don't repeat these cases under this heading. Usually this heading is used for when the description of the documentation requirement is longer and does not correspond directly to one, narrow normative sentence. 

Metrics

35 {metrics} Metrics that are specified for the time/space properties of the execution of certain language constructs. 

Implementation Permissions

36 {implementation permissions} Additional permissions given to the implementer.

36.a Discussion: For example, “The implementation is allowed to impose further restrictions on the record aggregates allowed in code statements.” When there are restrictions on the permission, those restrictions are given here also. For example, “An implementation is allowed to restrict the kinds of subprograms that are allowed to be main subprograms. However, it shall support at least parameterless procedures.” — we don't split this up between here and “Implementation Requirements.” 

Implementation Advice

37 {implementation advice} {advice} Optional advice given to the implementer. The word “should” is used to indicate that the advice is a recommendation, not a requirement. It is implementation defined whether or not a given recommendation is obeyed. 

37.a/2 Implementation defined: Whether or not each recommendation given in Implementation Advice is followed — see M.3, “Implementation Advice” for a listing.

37.b/1 Discussion: The advice generally shows the intended implementation, but the implementer is free to ignore it. The implementer is the sole arbiter of whether or not the advice has been obeyed, if not, whether the reason is a good one, and whether the required documentation is sufficient. It would be wrong for the ACATS to enforce any of this advice.

37.c For example, “Whenever possible, the implementation should choose a value no greater than fifty microseconds for the smallest representable duration, Duration'Small.”

37.d We use this heading, for example, when the rule is so low level or implementation-oriented as to be untestable. We also use this heading when we wish to encourage implementations to behave in a certain way in most cases, but we do not wish to burden implementations by requiring the behavior. 

NOTES

38 (1)  {notes} Notes emphasize consequences of the rules described in the (sub)clause or elsewhere. This material is informative. 

Examples

39 Examples illustrate the possible forms of the constructs described. This material is informative. 

39.a Discussion:  The next three headings list all language changes between Ada 83 and Ada 95. Language changes are any change that changes the set of text strings that are legal Ada programs, or changes the meaning of any legal program. Wording changes, such as changes in terminology, are not language changes. Each language change falls into one of the following three categories:

Inconsistencies With Ada 83

39.b {inconsistencies with Ada 83} This heading lists all of the upward inconsistencies between Ada 83 and Ada 95. Upward inconsistencies are situations in which a legal Ada 83 program is a legal Ada 95 program with different semantics. This type of upward incompatibility is the worst type for users, so we only tolerate it in rare situations.

39.c (Note that the semantics of a program is not the same thing as the behavior of the program. Because of Ada's indeterminacy, the “semantics” of a given feature describes a set of behaviors that can be exhibited by that feature. The set can contain more than one allowed behavior. Thus, when we ask whether the semantics changes, we are asking whether the set of behaviors changes.)

39.d/2 This is not part of the definition of the language, and does not appear in the Ada 95 or Ada 2005 RM.

Incompatibilities With Ada 83

39.e {incompatibilities with Ada 83} This heading lists all of the upward incompatibilities between Ada 83 and Ada 95, except for the ones listed under “Inconsistencies With Ada 83” above. These are the situations in which a legal Ada 83 program is illegal in Ada 95. We do not generally consider a change that turns erroneous execution into an exception, or into an illegality, to be upwardly incompatible.

39.f/2 This is not part of the definition of the language, and does not appear in the Ada 95 or Ada 2005 RM.

Extensions to Ada 83

39.g {extensions to Ada 83} This heading is used to list all upward compatible language changes; that is, language extensions. These are the situations in which a legal Ada 95 program is not a legal Ada 83 program. The vast majority of language changes fall into this category.

39.h/2 This is not part of the definition of the language, and does not appear in the Ada 95 or Ada 2005 RM.

39.i As explained above, the next heading does not represent any language change: 

Wording Changes from Ada 83

39.j/2 {wording changes from Ada 83} This heading lists some of the non-semantic changes between the Ada 83 RM and the the Ada 95 RM. It is incomplete; we have not attempted to list all wording changes, but only the “interesting” ones.

39.k/2 This is not part of the definition of the language, and does not appear in the Ada 95 or Ada 2005 RM.

39.l/2 Discussion: The next three headings list all language changes between Ada 95 and Ada 2005 (the language defined by the Ada 95 standard plus Technical Corrigendum 1 plus Amendment 1). Each language change falls into one of the following three categories: 

Inconsistencies With Ada 95

39.m/2 {inconsistencies with Ada 95} This heading lists all of the upward inconsistencies between Ada 95 and Ada 2005. Upward inconsistencies are situations in which a legal Ada 95 program is a legal Ada 2005 program with different semantics.

39.n/2 Inconsistencies marked with Corrigendum:{Corrigendum} are corrections to the original Ada 95 definition introduced by Corrigendum 1. Inconsistencies marked with Amendment Correction:{Amendment Correction} are corrections to the original Ada 95 definition added by Amendment 1. Formally, these are inconsistencies caused by Ada Issues classified as Binding Interpretations; implementations of Ada 95 are supposed to follow these corrections, not the original flawed language definition. Thus, these strictly speaking are not inconsistencies between Ada 95 and Ada 2005. Practically, however, they very well may be, as early Ada 95 implementations may not follow the recommendation. Inconsistencies so marked are not portable between Ada 95 implementations, while usually Ada 2005 will have more clearly defined behavior. Therefore, we document these for completeness.

39.o/2 This is not part of the definition of the language, and does not appear in the Ada 2005 RM.

Incompatibilities With Ada 95

39.p/2 {incompatibilities with Ada 95} This heading lists all of the upward incompatibilities between Ada 95 and Ada 2005, except for the ones listed under “Inconsistencies With Ada 95” above. These are the situations in which a legal Ada 95 program is illegal in Ada 2005.

39.q/2 As with inconsistencies, incompatibilities marked with Corrigendum: are corrections to the original Ada 95 definition introduced by Corrigendum 1. Incompatibilities marked with Amendment Correction: are corrections to the original Ada 95 definition added by Amendment 1. Formally, these are incompatibilities caused by Ada Issues classified as Binding Interpretations; implementations of Ada 95 are supposed to follow these corrections, not the original flawed language definition. Thus, these strictly speaking are not incompatibilities between Ada 95 and Ada 2005. Practically, however, they very well may be, as early Ada 95 implementations may not follow the recommendation. Therefore, some Ada 95 implementations may be able to compile the examples, while others may not. In constrast, Ada 2005 compilers will have consistent behavior. Therefore, we document these for completeness.

39.r/2 This is not part of the definition of the language, and does not appear in the Ada 2005 RM.

Extensions to Ada 95

39.s/2 {extensions to Ada 95} This heading is used to list all upward compatible language changes; that is, language extensions. These are the situations in which a legal Ada 2005 program is not a legal Ada 95 program. The vast majority of language changes fall into this category.

39.t/2 As with incompatibilities, extensions marked with Corrigendum: are corrections to the original Ada 95 definition introduced by Corrigendum 1. Extensions marked with Amendment Correction: are corrections to the original Ada 95 definition added by Amendment 1. Formally, these are extensions allowed by Ada Issues classified as Binding Interpretations. As corrections, implementations of Ada 95 are allowed to implement these extensions. Thus, these strictly speaking are not extensions of Ada 95; they're part of Ada 95. Practically, however, they very well may be extensions, as early Ada 95 implementations may not implement the extension. Therefore, some Ada 95 implementations may be able to compile the examples, while others may not. In constrast, Ada 2005 compilers will always support the extensions. Therefore, we document these for completeness.

39.u/2 This is not part of the definition of the language, and does not appear in the Ada 2005 RM.

39.v/2 As explained above, the next heading does not represent any language change: 

Wording Changes from Ada 95

39.w/2 {wording changes from Ada 95} This heading lists some of the non-semantic changes between the Ada 95 RM and the Ada 2005 RM. This heading lists only “interesting” changes (for instance, editorial corrections are not listed). Changes which come from Technical Corrigendum 1 are marked Corrigendum; unmarked changes come from Amendment 1.

39.x/2 This is not part of the definition of the language, and does not appear in the Ada 2005 RM.