Pristine Ack-5.5
[Ack-5.5.git] / doc / pascal / deviations.doc
1 .sp 2
2 .NH
3 Deviations from the standard
4 .nh
5
6 .PP
7 The compiler deviates from the ISO 7185 standard with respect to the
8 following clauses:
9
10 .IP "\fBISO 6.1.3:\fR" 14
11 \h'-5u'Identifiers may be of any length and all characters of an identifier
12 shall be significant in distinguishing between them.
13 .sp
14 .in +3m
15 The constant IDFSIZE, defined in the file \fIidfsize.h\fR, determines
16 the (maximum) significant length of an identifier. It can be set at run
17 time with the \-M option (see also section on compiler options).
18 .in -3m
19 .sp
20 .IP "\fBISO 6.1.8:\fR"
21 \h'-5u'There shall be at least one separator between any pair of consecutive tokens
22 made up of identifiers, word-symbols, labels or unsigned-numbers.
23 .sp
24 .in +3m
25 A token separator is not needed when a number is followed by an identifier
26 or a word-symbol. For example the input sequence, 2\fBthen\fR, is recognized
27 as the integer 2 followed by the keyword \fBthen\fR.
28 .in -3m
29 .sp
30 .IP "\fBISO 6.2.1:\fR"
31 \h'-29u'The label-declaration-part shall specify all labels that prefix a statement
32 in the corresponding statement-part.
33 .sp
34 .ti +3m
35 The compiler generates a warning if a label is declared but never defined.
36 .bp
37 .IP "\fBISO 6.2.2:\fR"
38 \h'-9u'The scope of identifiers and labels should start at the beginning of the
39 block in which these identifiers or labels are declared.
40 .sp
41 .in +3m
42 The compiler, as most other one pass compilers deviates in this respect,
43 because the scope of variables and labels start at their defining-point.
44 .nf
45 .in +4m
46 \fBprogram\fR deviates\fB;
47 const\fR
48         x \fB=\fR 3\fB;
49 procedure\fR p\fB;
50 const\fR
51         y \fB=\fR x\fB;\fR
52         x \fB=\fR true\fB;
53 begin end;
54 begin
55 end.\fR
56 .in -4m
57 .fi
58
59 In procedure p, the constant y has the integer value 3. This program does not
60 conform to the standard. In [SAL] a simple algorithm is described for
61 enforcing the scope rules, it involves numbering all scopes encoutered in the
62 program in order of their opening, and recording in each identifier table
63 entry the number of the latest scope in which it is used.
64
65 Note: The compiler does not deviate from the standard in the following program:
66 .nf
67 .in +4m
68 \fBprogram\fR conforms\fB;
69 type\fR
70         x \fB=\fR real\fB;
71 procedure\fR p\fB;
72 type\fR
73         y \fB= ^\fRx\fB;\fR
74         x \fB=\fR boolean\fB;
75 var\fR
76         p \fB:\fR y\fB;
77 begin end;
78 begin
79 end.\fR
80 .in -4m
81 .fi
82
83 In procedure p, the variable p is a pointer to boolean.
84 .fi
85 .in -3m
86 .sp
87 .IP "\fBISO 6.4.3.2:\fR"
88 The standard specifies that any ordinal type is allowed as index-type.
89 .sp
90 .in +3m
91 The required type \fIinteger\fR is not allowed as index-type, i.e.
92 .ti +2m
93 \fBARRAY [ \fIinteger\fB ] OF\fR <component-type>
94 is not permitted.
95 .br
96 This could be implemented, but this might cause problems on machines with
97 a small memory.
98 .in -3m
99 .sp
100 .IP "\fBISO 6.4.3.3:\fR"
101 \h'-1u'The type possessed by the variant-selector, called the tag-type, must
102 be an ordinal type, so the integer type is permitted. The values denoted by
103 all case-constants shall be distinct and the set thereof shall be equal
104 to the set of values specified by the tag-type.
105 .sp
106 .in +3m
107 Because it is impracticable to enumerate all integers as case-constants,
108 the integer type is not permitted as tag-type. It would not make a great
109 difference to allow it as tagtype.
110 .in -3m
111 .sp
112 .IP "\fBISO 6.8.3.9:\fR"
113 The standard specifies that the control-variable of a for-statement is not
114 allowed to be modified while executing the loop.
115 .sp
116 .in +3m
117 Violation of this rule is not detected. An algorithm to implement this rule
118 can be found in [PCV].