Units

Syntax

The BNF language unit structure may be represented as follows:

$ Sub = ident ";" [ImportList]

{ DeclarationSequence | ClassDeclaration | InterfaceDeclaration | DelegateDeclaration | EnumDeclaration} BEGIN [StatementSequence] END SUB ident "."

$ ImportList = IMPORT import {"," import} ";"

$ import = ident

$ DeclarationSequence = Declaration { ";" Declaration )

$ Declaration = { ConstantDeclaration } | { VariableDeclaration } | { ProcedureDeclaration} | { FunctionDeclaration }

Description

Unit is a set of definitions and a sequence of statements, which initialize the unit.

A unit is the basic language syntax unit. Each unit is a finite sequence of language dictionary characters. To write unit code you can use any Unicode characters, except for service characters (characters with codes U0000-U0008, U000B, U000C, U000E-U001B) and the following sequence of characters: ]]> (this is caused by the features of storing unit or form texts in the platform).

NOTE. If the unit code contains one or more forbidden characters, an appropriate error message is displayed on an attempt to save or compile this unit.

The unit may import descriptions from the other units from the import list. To call the variables and methods defined in the imported unit, use the qualified identifiers syntax, where the imported unit name is used as a prefix.

A unit contains a set of description blocks. A unit is an enclosing block for each description block. A description block may consist of other description blocks; and it is the enclosing block, referring to its enclosed blocks. Any identifier may be described only once in the description block. When an identifier is used, its first description in the enclosing blocks list (beginning from the innermost block) is used.

The description block from the imported unit is the enclosing block for the current unit.

The language enables the user to execute some sequence of initializing statements during the unit-into-system loading process. This statements sequence is specified in unit body after the BEGIN keyword.

NOTE. Any Unicode characters can be used to write unit code.

Example

The simple program unit example:

Sub Main; // Declare Main unit start

Var // Variables description section

c: Integer; // Describe Integer type variable

Begin //Program text start

c := 0;

If c < 10 Then

c := c + 1;

End If;

End Sub Main; // Declare Main unit end