1.5. Method of Description and Syntax Notation

[PREVIOUS][UP][NEXT]

The form of Ada program units is described by means of a context-free syntax together with context-dependent requirements expressed by narrative rules.

The meaning of Ada program units is described by means of narrative rules defining both the effects of each construct and the composition rules for constructs. This narrative employs technical terms whose precise definition is given in the text (references to the section containing the definition of a technical term appear at the end of each section that uses the term).

All other terms are in the English language and bear their natural meaning, as defined in Webster's Third New International Dictionary of the English Language.

The context-free syntax of the language is described using a simple variant of Backus-Naur-Form. In particular,

  1. Lower case words, some containing embedded underlines, are used to denote syntactic categories, for example:

    adding_operator

    Whenever the name of a syntactic category is used apart from the syntax rules themselves, spaces take the place of the underlines (thus: adding operator).

  2. Boldface words are used to denote reserved words, for example:

    array

  3. Square brackets enclose optional items. Thus the two following rules are equivalent.

    return_statement ::= return [expression]; return_statement ::= return; | return expression;

  4. Braces 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

  5. A vertical bar separates alternative items unless it occurs immediately after an opening brace, in which case it stands for itself:

    letter_or_digit ::= letter | digit component_association ::= [choice {| choice} =>] expression

  6. 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 type_name and task_name are both equivalent to name alone.

Note:

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
          sequence_of_statements
       {elsif condition then
          sequence_of_statements}
       [else
          sequence_of_statements]
        end if; 

Different lines are used for parts of a syntax rule if the corresponding parts of the construct described by the rule are intended to be on different lines. Indentation in the rule is a recommendation for indentation of the corresponding part of the construct. It is recommended that all indentations be by multiples of a basic step of indentation (the number of spaces for the basic step is not defined). The preferred places for other line breaks are after semicolons. On the other hand, if a complete construct can fit on one line, this is also allowed in the recommended paragraphing.


[INDEX][CONTENTS]