Ada Conformity Assessment Authority      Home Conformity Assessment   Test Suite ARGAda Standard
Ada Reference ManualLegal Information
Contents   Index   References   Search   Previous   Next 

1.1.4 Method of Description and Syntax Notation

The form of an Ada program is described by means of a context-free syntax together with context-dependent requirements expressed by narrative rules.
The meaning of Ada programs is described by means of narrative rules defining both the effects of each construct and the composition rules for constructs.
The context-free syntax of the language is described using a simple variant of Backus-Naur Form. In particular: 
Lower case words in a sans-serif font, some containing embedded underlines, are used to denote syntactic categories, for example: 
Boldface words are used to denote reserved words, for example: 
Square brackets enclose optional items. Thus the two following rules are equivalent. 
simple_return_statement ::= return [expression];
simple_return_statement ::= return; | return expression;
Curly brackets enclose a repeated item. The item may appear zero or more times; the repetitions occur from left to right as with an equivalent left-recursive rule. Thus the two following rules are equivalent. 
term ::= factor {multiplying_operator factor}
term ::= factor | term multiplying_operator factor
A vertical line separates alternative items unless it occurs immediately after an opening curly bracket, in which case it stands for itself: 
constraint ::= scalar_constraint | composite_constraint
discrete_choice_list ::= discrete_choice {| discrete_choice}
If the name of any syntactic category starts with an italicized part, it is equivalent to the category name without the italicized part. The italicized part is intended to convey some semantic information. For example subtype_name and task_name are both equivalent to name alone. 
   The delimiters, compound delimiters, reserved words, and numeric_literals are exclusively made of the characters whose code point is between 16#20# and 16#7E#, inclusively. The special characters for which names are defined in this International Standard (see 2.1) belong to the same range. For example, the character E in the definition of exponent is the character whose name is “LATIN CAPITAL LETTER E”, not “GREEK CAPITAL LETTER EPSILON”. 
   When this International Standard mentions the conversion of some character or sequence of characters to upper case, it means the character or sequence of characters obtained by using simple upper case mapping, as defined by documents referenced in the note in Clause 1 of ISO/IEC 10646:2011. 
A syntactic category is a nonterminal in the grammar defined in BNF under “Syntax.” Names of syntactic categories are set in a different font, like_this.
A construct is a piece of text (explicit or implicit) that is an instance of a syntactic category defined under “Syntax”. 
A constituent of a construct is the construct itself, or any construct appearing within it.
Whenever the run-time semantics defines certain actions to happen in an arbitrary order, this means that the implementation shall arrange for these actions to occur in a way that is equivalent to some sequential order, following the rules that result from that sequential order. When evaluations are defined to happen in an arbitrary order, with conversion of the results to some subtypes, or with some run-time checks, the evaluations, conversions, and checks may be arbitrarily interspersed, so long as each expression is evaluated before converting or checking its value. Note that the effect of a program can depend on the order chosen by the implementation. This can happen, for example, if two actual parameters of a given call have side effects. 
3  The syntax rules describing structured constructs are presented in a form that corresponds to the recommended paragraphing. For example, an if_statement is defined as: 
if_statement ::=
    if condition then
   {elsif condition then
    end if;
4  The line breaks and indentation in the syntax rules indicate the recommended line breaks and indentation in the corresponding constructs. The preferred places for other line breaks are after semicolons. 

Contents   Index   References   Search   Previous   Next 
Ada-Europe Ada 2005 and 2012 Editions sponsored in part by Ada-Europe