Home Random Page


CATEGORIES:

BiologyChemistryConstructionCultureEcologyEconomyElectronicsFinanceGeographyHistoryInformaticsLawMathematicsMechanicsMedicineOtherPedagogyPhilosophyPhysicsPolicyPsychologySociologySportTourism






Definitional conventions

The metalanguage used in this International Standard to specify the syntax of the constructs is based on Backus-Naur Form. The notation has been modified from the original to permit greater convenience of description and to allow for iterative productions to replace recursive ones. Table 1 lists the meanings of the various metasymbols. Further specification of the constructs is given by prose and, in some cases, by equivalent program fragments. Any identifier that is defined in clause 6 as a required identifier shall denote the corresponding required entity by its occurrence in such a program fragment. In all other respects, any such program fragment is bound by any pertinent requirement of this International Standard.

A meta-identifier shall be a sequence of letters and hyphens beginning with a letter.

A sequence of terminal and nonterminal symbols in a production implies the concatenation of the text that they ultimately represent. Within 6.1 this concatenation is direct; no characters shall intervene. In all other parts of this International Standard the concatenation is in accordance with the rules set out in 6.1.

The characters required to form Pascal programs shall be those implicitly required to form the tokens and separators defined in 6.1.

Use of the words of, in, containing, and closest-containing, when expressing a relationship between terminal or nonterminal symbols, shall have the following meanings

---the x of a y: refers to the x occurring directly in a production defining y;

---the x in a y: is synonymous with 'the x of a y';

---a y containing an x: refers to any y from which an x is directly or indirectly derived;

---the y closest-containing an x: that y containing an x and not containing another y containing that x.

These syntactic conventions are used in clause 6 to specify certain syntactic requirements and also the contexts within which certain semantic specifications apply.

In addition to the normal English rules for hyphenation, hyphenation is used in this International Standard to form compound words that represent meta-identifiers, semantic terms, or both. All meta-identifiers that contain more than one word are written as a unit with hyphens joining the parts. Semantic terms ending in ''type'' and ''variable'' are also written as one hyphenated unit. Semantic terms representing compound ideas are likewise written as hyphenated units, e.g., digit-value, activation-point, assignment-compatible, and identifying-value.

NOTES are included in this International Standard only for purposes of clarification, and aid in the use of the standard. NOTES are informative only and are not a part of the International Standard.

Examples in this International Standard are equivalent to NOTES.

 

Compliance

There are two levels of compliance, level 0 and level 1. Level 0 does not include conformant- array-parameters. Level 1 does include conformant-array-parameters.

 

Processors



A processor complying with the requirements of this International Standard shall

a) if it complies at level 0, accept all the features of the language specified in clause 6, except for 6.6.3.6 e), 6.6.3.7, and 6.6.3.8, with the meanings defined in clause 6;

b) if it complies at level 1, accept all the features of the language specified in clause 6 with the meanings defined in clause 6;

c) not require the inclusion of substitute or additional language elements in a program in order to accomplish a feature of the language that is specified in clause 6;

d) be accompanied by a document that provides a definition of all implementation-defined features;

e) be able to determine whether or not the program violates any requirements of this International Standard, where such a violation is not designated an error, report the result of this determination to the user of the processor before the execution of the program-block, if any, and shall prevent execution of the program-block, if any;

f) treat each violation that is designated an error in at least one of the following ways

1) there shall be a statement in an accompanying document that the error is not reported, and a note referencing each such statement shall appear in a separate section of the accompanying document;

2) the processor shall report the error or the possibility of the error during preparation of the program for execution and in the event of such a report shall be able to continue further processing and shall be able to refuse execution of the program-block;

3) the processor shall report the error during execution of the program;

and if an error is reported during execution of the program, the processor shall terminate execution; if an error occurs within a statement, the execution of that statement shall not be completed;

 

NOTE --- 1 This means that processing will continue up to or beyond execution of the program at the option of the user.

 

g) be accompanied by a document that separately describes any features accepted by the processor that are prohibited or not specified in clause 6: such extensions shall be described as being 'extensions to Pascal as specified by ISO/IEC 7185';

h) be able to process, in a manner similar to that specified for errors, any use of any such extension;

i) be able to process, in a manner similar to that specified for errors, any use of an implementation- dependent feature.

 

NOTE --- 2 The phrase 'be able to' is used in 5.1 to permit the implementation of a switch with which the user may control the reporting.

 

A processor that purports to comply, wholly or partially, with the requirements of this International Standard shall do so only in the following terms. A compliance statement shall be produced by the processor as a consequence of using the processor or shall be included in accompanying documentation. If the processor complies in all respects with the requirements of this International Standard, the compliance statement shall be

<This processor> complies with the requirements of level <number> of ISO/IEC 7185.

If the processor complies with some but not all of the requirements of this International Standard then it shall not use the above statement, but shall instead use the following compliance statement

<This processor> complies with the requirements of level <number> of ISO/IEC 7185, with the following exceptions: <followed by a reference to, or a complete list of, the requirements of the International Standard with which the processor does not comply>.

In both cases the text <This processor> shall be replaced by an unambiguous name identifying the processor, and the text <number> shall be replaced by the appropriate level number.

 

NOTE --- 3 Processors that do not comply fully with the requirements of the International Standard are not required to give full details of their failures to comply in the compliance statement; a brief reference to accompanying documentation that contains a complete list in sufficient detail to identify the defects is sufficient.

 

Programs

A program conforming with the requirements of this International Standard shall

a) if it conforms at level 0, use only those features of the language specified in clause 6, except for 6.6.3.6 e), 6.6.3.7, and 6.6.3.8;

b) if it conforms at level 1, use only those features of the language specified in clause 6; and

c) not rely on any particular interpretation of implementation-dependent features.

 

NOTES

1 A program that complies with the requirements of this International Standard may rely on particular implementation-defined values or features.

2 The requirements for conforming programs and compliant processors do not require that the results produced by a conforming program are always the same when processed by a compliant processor. They may be the same, or they may differ, depending on the program. A simple program to illustrate this is

program x(output); begin writeln(maxint) end.


ISO/IEC 7185:1990(E)

Requirements

 

Lexical tokens

 

NOTE --- The syntax given in this subclause describes the formation of lexical tokens from characters and the separation of these tokens and therefore does not adhere to the same rules as the syntax in the rest of this International Standard.

 

General

The lexical tokens used to construct Pascal programs are classified into special-symbols, identifiers, directives, unsigned-numbers, labels, and character-strings. The representation of any letter (upper case or lower case, differences of font, etc.) occurring anywhere outside of a character- string (see 6.1.7) shall be insignificant in that occurrence to the meaning of the program.

letter = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o'

| 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' .

digit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' .

 

Special-symbols

The special-symbols are tokens having special meanings and are used to delimit the syntactic units of the language.

special-symbol = '+' | ' -' | '*' |'/' | '=' | '<' |'>' | '[' | ']' | '.' | ',' | ':' | ';'

| '­' | '(' | ')' | '<>' | '<=' | '>=' | ':=' | '..' | word-symbol .

word-symbol = 'and' | 'array' | 'begin' | 'case' | 'const' | 'div' | 'do' | 'downto' | 'else'

| 'end' | 'file' | 'for' | 'function' | 'goto' | 'if' | 'in' | 'label' | 'mod'

| 'nil' | 'not' | 'of' | 'or' | 'packed' | 'procedure' | 'program' | 'record'

| 'repeat' | 'set' | 'then' | 'to' | 'type' | 'until' | 'var' | 'while' | 'with' .

 

Identifiers

Identifiers can be of any length. The spelling of an identifier shall be composed from all its constituent characters taken in textual order, without regard for the case of letters. No identifier shall have the same spelling as any word-symbol. Identifiers that are specified to be required shall have special significance (see 6.2.2.10 and 6.10).

identifier = letter { letter | digit } .

 

Examples:

X

time

readinteger

WG4

AlterHeatSetting

InquireWorkstationTransformation

InquireWorkstationIdentification

 

Directives

A directive shall only occur in a procedure-declaration or a function-declaration. The only directive shall be the required directive forward (see 6.6.1 and 6.6.2). No directive shall have the same spelling as any word-symbol.

directive = letter { letter | digit } .

 

NOTE --- Many processors provide, as an extension, the directive external, which is used to specify that the procedure-block or function-block corresponding to that procedure-heading or function-heading is external to the program-block. Usually it is in a library in a form to be input to, or that has been produced by, the processor.

 

Numbers

An unsigned-integer shall denote in decimal notation a value of integer-type (see 6.4.2.2). An unsigned-real shall denote in decimal notation a value of real-type (see 6.4.2.2). The letter 'e' preceding a scale-factor shall mean times ten to the power of. The value denoted by an unsigned-integer shall be in the closed interval 0 to maxint (see 6.4.2.2 and 6.7.2.2).

signed-number = signed-integer | signed-real .

signed-real = [ sign ] unsigned-real .

signed-integer = [ sign ] unsigned-integer .

unsigned-number = unsigned-integer | unsigned-real .

sign = '+' | '-' .

unsigned-real= digit-sequence '.' fractional-part [ 'e' scale-factor] ½ digit-sequence 'e' scale-factor .

unsigned-integer = digit-sequence .

fractional-part = digit-sequence .

scale-factor = [ sign ] digit-sequence .

digit-sequence = digit { digit } .

Examples:

1e10

+100

-0.1

5e-3

87.35E+8

 

Labels

Labels shall be digit-sequences and shall be distinguished by their apparent integral values and shall be in the closed interval 0 to 9999. The spelling of a label shall be its apparent integral value.

label = digit-sequence .

 

Character-strings

A character-string containing a single string-element shall denote a value of the required char-type (see 6.4.2.2). A character-string containing more than one string-element shall denote a value of a string-type (see 6.4.3.2) with the same number of components as the character-string contains string-elements. All character-strings with a given number of components shall possess the same string-type.

There shall be an implementation-defined one-to-one correspondence between the set of alternatives from which string-elements are drawn and a subset of the values of the required char-type. The occurrence of a string-element in a character-string shall denote the occurrence of the corresponding value of char-type.

character-string = ''' string-element { string-element } ''' .

string-element = apostrophe-image | string-character .

apostrophe-image = '''' .

string-character = one-of-a-set-of-implementation-defined-characters .

 

NOTE --- Conventionally, the apostrophe-image is regarded as a substitute for the apostrophe character, which cannot be a string-character.

 

Examples:

'A'

';'

''''

'Pascal'

'THIS IS A STRING'

 

Token separators

Where a commentary shall be any sequence of characters and separations of lines, containing neither } nor *), the construct

( '{' | '(*' ) commentary ( '*)' | '}' )

shall be a comment if neither the { nor the (* occurs within a character-string or within a commentary.

 

NOTES

1 A comment may thus commence with { and end with *), or commence with (* and end with }.

2 The sequence (*) cannot occur in a commentary even though the sequence { ) can.

 

Comments, spaces (except in character-strings), and the separations of consecutive lines shall be considered to be token separators. Zero or more token separators can occur between any two consecutive tokens, before the first token of a program text, or after the last token of the program text. There shall be at least one separator between any pair of consecutive tokens made up of identifiers, word-symbols, labels or unsigned-numbers. No separators shall occur within tokens.

 


Date: 2015-12-24; view: 789


<== previous page | next page ==>
Normative reference | Lexical alternatives
doclecture.net - lectures - 2014-2024 year. Copyright infringement or personal data (0.012 sec.)