Lady Ada

Ada '83 Language Reference Manual

Copyright 1980, 1982, 1983 owned by the United States Government. Direct reproduction and usage requests to the Ada Information Clearinghouse.

1.5. Method of Description and Syntax Notation


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:
    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:
  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.

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; 

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.

Rationale references: 2.1 Lexical Structure, 2.2 Textual Structure

Style Guide references: 2.1.8 Number of Statements Per Line


[Ada Information Clearinghouse]

Address any questions or comments to