| Section 6: The Language |

This section describes the structure and meaning of a Sather program by specifying its components and stating the rules governing their combination. The major components are classes, one of which is distinguished as the program class.

There are two principal kinds of class which go to make up a program -

1. Abstract Classes - an abstract class specifies the behaviour of classes which sub-type from it. An abstract class may inherit from one or more other abstract classes. In other programming languages the term abstract data type
2. Implementation Classes - all other classes are known as implementation classes which are required to implement the definition of some concept or model which is needed by a library or an application program. An implementation class is required to implement all features of those abstract classes from which it sub-types either directly or indirectly.

#### Abstract Syntax

The use of abstract syntax in this specification is a departure from the more usual usage in which abstract syntax merely reflects the content of a concrete syntax expression without its form (ie syntactic noise has been removed).

Apart from the basic class structure, the abstract syntax for a Sather class consists of a collection of features (which may be values, methods or merely signatures) which may have value (ie be expressed as an expression), implementation (ie be expressed as a sequence of statements) or abstract (having neither value nor implementation).

The employment of this structure, while originally intended as an implementation mechanism, results in a much simpler description of a program than would otherwise be the case. Limitations on the structure are therefore represented by a suitable invariant. This does not affect the semantics of the definitions, whether static, declaration or dynamic.

#### Meaning

The meaning of an identifier at the point of its use is specified by the environment that applies at that point in the source text. An environment associates an identifier with some particular object or other entity and with that objects properties. An environment that applies at the point of use of an identifier is constructed from the environment that applies in a textually enclosing class or method, from inclusions and from defining occurrences in definitions and declarations.

Environments may be determined/constructed in three ways :-

- in order to express well-formedness, referring only to properties that are relevant to such conditions such as the types of variables and arguments.
- in order to express the meaning of a program, referring to properties required for execution including the storage required for state (of a method or enclosing class).
- If some identifier is not visible in a constructed environment then the environment which applies is that in which only the pervasive identifiers are visible.

The meaning of a Sather program is described by the effect which its execution has on the external state (of any number of individual components of the execution environment).

### Document Structure

This specification is divided into the following sub-sections which follow the form of the original language specification :-

1. Program Components
2. Class Definitions
3. Method Signatures
4. Type Definitions
5. Type Compatibility & Type Graph
6. Feature Definitions
7. Statements
8. Expressions

| Specification Index |  | Language Index

Comments or enquiries should be made to Keith Hopper. Page last modified: Monday, 22 May 2000. |