Home Random Page


CATEGORIES:

BiologyChemistryConstructionCultureEcologyEconomyElectronicsFinanceGeographyHistoryInformaticsLawMathematicsMechanicsMedicineOtherPedagogyPhilosophyPhysicsPolicyPsychologySociologySportTourism






Lexical alternatives

The representation for lexical tokens and separators given in 6.1.1 to 6.1.8, except for the character sequences (* and *), shall constitute a reference representation for these tokens and separators.

To facilitate the use of Pascal on processors that do not support the reference representation, the following alternatives have been defined. All processors that have the required characters in their character set shall provide both the reference representations and the alternative representations, and the corresponding tokens or separators shall not be distinguished. Provision of the reference representations, and of the alterative token @, shall be implementation-defined.

The alternative representations for the tokens shall be

Reference token Alternative token

­ @

[ (.

] .)

 

NOTE --- 1 The character ­ that appears in some national variants of ISO 646 is regarded as identical to the character Ó. In this International Standard, the character ­has been used because of its greater visibility.

 

The comment-delimiting characters { and } shall be the reference representations, and (* and *) respectively shall be alternative representations (see 6.1.8).

 

NOTE --- 2 See also 1.2 f).

 

 

Blocks, scopes, and activations

 

Blocks

A block closest-containing a label-declaration-part in which a label occurs shall closest-contain exactly one statement in which that label occurs. The occurrence of a label in the label-declaration-part of a block shall be its defining-point for the region that is the block. Each applied occurrence of that label (see 6.2.2.8) shall be a label. Within an activation of the block, all applied occurrences of that label shall denote the corresponding program-point in the algorithm of the activation at that statement (see 6.2.3.2 b)).

block = label-declaration-part constant-definition-part type-definition-part

variable-declaration-part procedure-and-function-declaration-part

statement-part .

label-declaration-part = [ 'label' label { ',' label } ';' ] .

constant-definition-part = [ 'const' constant-definition ';' { constant-definition ';' } ] .

type-definition-part = [ 'type' type-definition ';' { type-definition ';' } ] .

variable-declaration-part = [ 'var' variable-declaration ';' { variable-declaration ';' } ] .

procedure-and-function-declaration-part = { ( procedure-declaration ½ function-declaration ) ';' } .

The statement-part shall specify the algorithmic actions to be executed upon an activation of the block.

statement-part = compound-statement .

 

Scopes

 

6.2.2.1

Each identifier or label contained by the program-block shall have a defining-point.

 

6.2.2.2

Each defining-point shall have a region that is a part of the program text, and a scope that is a part or all of that region.

 

6.2.2.3



The region of each defining-point is defined elsewhere (see 6.2.1, 6.2.2.10, 6.3, 6.4.1, 6.4.2.3, 6.4.3.3, 6.5.1, 6.5.3.3, 6.6.1, 6.6.2, 6.6.3.1, 6.8.3.10, 6.10).

 

6.2.2.4

The scope of each defining-point shall be its region (including all regions enclosed by that region) subject to 6.2.2.5 and 6.2.2.6.

 

6.2.2.5

When an identifier or label has a defining-point for region A and another identifier or label having the same spelling has a defining-point for some region B enclosed by A, then region B and all regions enclosed by B shall be excluded from the scope of the defining-point for region A.

 

6.2.2.6

The region that is the field-specifier of a field-designator shall be excluded from the enclosing scopes.

 

6.2.2.7

When an identifier or label has a defining-point for a region, another identifier or label with the same spelling shall not have a defining-point for that region.

 

6.2.2.8

Within the scope of a defining-point of an identifier or label, each occurrence of an identifier or label having the same spelling as the identifier or label of the defining-point shall be designated an applied occurrence of the identifier or label of the defining-point, except for an occurrence that constituted the defining-point; such an occurrence shall be designated a defining occurrence. No occurrence outside that scope shall be an applied occurrence.

 

NOTE --- Within the scope of a defining-point of an identifier or label, there are no applied occurrences of an identifier or label that cannot be distinguished from it and have a defining-point for a region enclosing that scope.

 

6.2.2.9

The defining-point of an identifier or label shall precede all applied occurrences of that identifier or label contained by the program-block with one exception, namely that an identifier can have an applied occurrence in the type-identifier of the domain-type of any new-pointer-types contained by the type-definition-part containing the defining-point of the type-identifier.

 

6.2.2.10

Required identifiers that denote required values, types, procedures, and functions shall be used as if their defining-points have a region enclosing the program (see 6.1.3, 6.3, 6.4.1, and 6.6.4.1).

 

NOTE --- The required identifiersinput and output are not included, since these denote variables.

 

6.2.2.11

Whatever an identifier or label denotes at its defining-point shall be denoted at all applied occurrences of that identifier or label.

 

NOTES

1 Within syntax definitions, an applied occurrence of an identifier is qualified (e.g., type-identifier), whereas a use that constitutes a defining-point is not qualified.

2 It is intended that such qualification indicates the nature of the entity denoted by the applied occurrence: e.g., a constant-identifier denotes a constant.

 

Activations

 

6.2.3.1

A procedure-identifier or function-identifier having a defining-point for a region that is a block within the procedure-and-function-declaration-part of that block shall be designated local to that block.

 

6.2.3.2

The activation of a block shall contain

a) for the statement-part of the block, an algorithm, the completion of which shall terminate the activation (see also 6.8.2.4);

b) for each defining-point of a label in the label-declaration-part of the block, a corresponding program-point (see 6.2.1);

c) for each variable-identifier having a defining-point for the region that is the block, a variable possessing the type associated with the variable-identifier;

d) for each procedure-identifier local to the block, a procedure with the procedure-block corresponding to the procedure-identifier, and the formal-parameters of that procedure-block;

e) for each function-identifier local to the block, a function with the function-block corresponding to, and the result type associated with, the function-identifier, and the formal-parameters of that function-block;

f) if the block is a function-block, a result possessing the associated result type.

 

NOTE --- Each activation contains its own algorithm, program-points, variables, procedures, and functions, distinct from every other activation.

 

6.2.3.3

The activation of a procedure or function shall be an activation of the block of the procedure-block of the procedure or function-block of the function, respectively, and shall be designated as within

a) the activation containing the procedure or function; and

b) all activations that that containing activation is within.

 

NOTE --- An activation of a block B can only be within activations of blocks containing B. Thus, an activation is not within another activation of the same block.

 

Within an activation, an applied occurrence of a label or variable-identifier, or of a procedure-identifier or function-identifier local to the block of the activation, shall denote the corresponding program-point, variable, procedure, or function, respectively, of that activation; except that the function-identifier of an assignment-statement shall, within an activation of the function denoted by that function-identifier, denote the result of that activation.

 

6.2.3.4

A procedure-statement or function-designator contained in the algorithm of an activation and that specifies an activation of a block shall be designated the activation-point of the activation of the block.

 

6.2.3.5

All variables contained by an activation, except for those listed as program-parameters, and any result of an activation, shall be totally-undefined at the commencement of that activation. The algorithm, program-points, variables, procedures, and functions, if any, shall exist until the termination of the activation.

 


Date: 2015-12-24; view: 751


<== previous page | next page ==>
Definitional conventions | Constant-definitions
doclecture.net - lectures - 2014-2024 year. Copyright infringement or personal data (0.01 sec.)