Debian Codegraph @

source_2005/02.mss

raw
1 @Part(02, Root="ada.mss")
2
3 @Comment{$Date: 2006/10/18 00:25:23 $}
4 @LabeledSection{Lexical Elements}
5
6 @Comment{$Source: e:\\cvsroot/ARM/Source/02.mss,v $}
7 @Comment{$Revision: 1.60 $}
8
9 @begin{Intro}
10 @redundant[The text of a program consists of the texts of one or more
11 @nt<compilation>s. The text of a @nt<compilation> is a sequence of
12 lexical elements, each composed of characters; the rules of
13 composition are given in this section.
14 @nt{Pragma}s, which provide certain information for the compiler, are also
15 described in this section.]
16 @end{Intro}
17
18 @LabeledClause{Character Set}
19
20 @begin{Intro}
21 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01],ARef=[AI95-00395-01]}
22 @Defn{character set}
23 The @Chg{Version=[2],New=[character repertoire for the text of an Ada
24 program consists of the
25 entire coding space described by the ISO/IEC 10646:2003 Universal
26 Multiple-Octet Coded Character Set. This coding space is organized in
27 @i<planes>, each plane comprising 65536 characters.@Defn2{Term=[plane],Sec=[character]}
28 @Defn{character plane}],Old=[only characters
29 allowed outside of @nt{comment}s are the @nt{graphic_character}s and
30 @ntf{format_effector}s.]}
31
32 @begin{Ramification}
33 @ChgRef{Version=[2],Kind=[Deleted],ARef=[AI95-00285-01]}
34 @ChgDeleted{Version=[2],Text=[Any character, including an
35 @ntf<other_control_function>, is allowed in a comment.]}
36
37 @ChgRef{Version=[2],Kind=[Deleted],ARef=[AI95-00285-01]}@ChgNote{Moved below}
38 @ChgDeleted{Version=[2],Text=[Note that this rule doesn't really have much
39 force, since the implementation can represent characters in the source in any
40 way it sees fit.
41 For example, an implementation could simply define that what seems to be
42 a non-graphic, non-format-effector character is actually a
43 representation of the space character.]}
44 @end{Ramification}
45 @begin(Discussion)
46 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]}
47 It is our intent to follow the terminology of
48 @Chg{Version=[2],New=[ISO/IEC 10646:2003],Old=[ISO 10646 BMP]} where
49 appropriate, and to remain compatible with the character
50 classifications defined in @RefSec{Character Handling}.@Chg{Version=[2],
51 New=[],Old=[Note that our definition for
52 @nt<graphic_character> is more inclusive than that of ISO 10646-1.]}
53 @end(Discussion)
54 @end{Intro}
55
56 @begin{Syntax}
57 @begin{NotIso}
58 @ChgAdded{Version=[2],Noprefix=[T],Noparanum=[T],Text=[@Shrink{@i<Paragraphs 2 and 3
59 were deleted.>}]}@Comment{This message should be
60 deleted if the paragraphs are ever renumbered.}
61 @end{NotIso}
62 @ChgRef{Version=[2],Kind=[DeletedNoDelMsg],ARef=[AI95-00285-01]}
63 @DeletedSyn{Version=[2],lhs=<@Chg{Version=[2],New=<>,Old=<character>}>,
64 rhs="@Chg{Version=[2],New=<>,Old=<@Syn2{graphic_character} | @Synf{format_effector} | @Synf{other_control_function}>}"}
65
66 @ChgRef{Version=[2],Kind=[DeletedNoDelMsg],ARef=[AI95-00285-01]}
67 @DeletedSyn{Version=[2],lhs=<@Chg{Version=[2],New=<>,Old=<graphic_character>}>,
68 rhs="@Chg{Version=[2],New=<>,Old=<@Synf{identifier_letter} | @Synf{digit} | @Synf{space_character} | @Synf{special_character}>}"}
69
70 @begin{SyntaxText}
71 @ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01],ARef=[AI95-00395-01]}
72 @ChgAdded{Version=[2],Text=[A @ntf{character} is defined by this International
73 Standard for each cell in the coding space described by ISO/IEC 10646:2003,
74 regardless of whether or not ISO/IEC 10646:2003 allocates a character to that
75 cell.]}
76 @end{SyntaxText}
77 @end{Syntax}
78
79 @begin{StaticSem}
80 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01],ARef=[AI95-00395-01]}
81 The@Chg{Version=[2],New=[],Old=[ character repertoire for the text of
82 an Ada program consists of the
83 collection of characters
84 @Chg{Version=[2],New=[described by the ISO/IEC 10646:2003],
85 Old=[called the Basic Multilingual Plane (BMP) of the
86 ISO 10646]} Universal Multiple-Octet Coded Character Set, plus a set
87 of @ntf<format_effector>s and, in comments only,
88 a set of @ntf<other_control_function>s; the]} coded representation for
89 @Chg{Version=[2],New=[],Old=[these ]}characters is implementation defined
90 @Redundant[(it need not be a
91 representation defined within @Chg{Version=[2],New=[ISO/IEC 10646:2003],
92 Old=[ISO-10646-1]})].@Chg{Version=[2],New=[ A character whose relative
93 code position in its plane is 16#FFFE# or 16#FFFF# is not allowed anywhere
94 in the text of a program.],Old=[]}
95 @ImplDef{The coded representation for the text of an Ada program.}
96
97 @begin{Ramification}@ChgNote{Moved from above}
98 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]}
99 @ChgAdded{Version=[2],Text=[Note that this rule doesn't really have
100 much force, since the implementation can represent characters in the
101 source in any way it sees fit.
102 For example, an implementation could simply define that what seems to be
103 an @ntf{other_private_use} character is actually a
104 representation of the space character.]}
105 @end{Ramification}
106
107 @ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]}
108 @ChgAdded{Version=[2],Text=[The semantics of an Ada program whose text is not
109 in Normalization Form KC (as defined by section 24 of ISO/IEC 10646:2003)
110 is implementation defined.]}
111 @ChgImplDef{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2],Text=[The
112 semantics of an Ada program whose text is not in Normalization Form KC.]}]}
113
114 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]}
115 The description of the
116 language definition in this International Standard uses the @Chg{Version=[2],
117 New=[character properties General Category, Simple Uppercase Mapping,
118 Uppercase Mapping, and Special Case Condition of the documents referenced by
119 the note in section 1 of ISO/IEC 10646:2003],Old=[graphic symbols
120 defined for Row 00: Basic Latin and Row 00: Latin-1 Supplement
121 of the ISO 10646 BMP; these correspond to the graphic symbols of
122 ISO 8859-1 (Latin-1); no graphic symbols are used in this International Standard for
123 characters outside of Row 00 of the BMP]}.
124 The actual set of graphic symbols used by an implementation
125 for the visual representation of
126 the text of an Ada program is not specified.
127 @PDefn{unspecified}
128
129 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]}
130 @Leading@keepnext@;@Chg{Version=[2],New=[Characters],Old=[The categories of
131 characters]} are @Chg{Version=[2],New=[categorized],Old=[defined]} as follows:
132 @begin{Discussion}
133 @ChgRef{Version=[2],Kind=[AddedNormal]}
134 @ChgAdded{Version=[2],Text=[Our character classification considers that the
135 cells not allocated in ISO/IEC 10646:2003 are graphic characters, except for
136 those whose relative code position in their plane is 16#FFFE# or 16#FFFF#. This
137 seems to provide the best compatibility with future versions of ISO/IEC 10646,
138 as future characters can be already be used in Ada character and string
139 literals.]}
140 @end{Discussion}
141 @begin{Description}
142 @ChgRef{Version=[2],Kind=[Deleted],ARef=[AI95-00285-01]}
143 @ChgDeleted{Version=[2],Text=[@Defn{identifier_letter}@ntf<identifier_letter>@\@ntf{upper_case_identifier_letter} | @ntf{lower_case_identifier_letter}]}
144 @begin{Discussion}
145 @ChgRef{Version=[2],Kind=[DeletedNoDelMsg]}
146 @ChgDeleted{Version=[2],Text=[We use @ntf<identifier_letter>
147 instead of simply @ntf<letter> because
148 ISO 10646 BMP includes many other characters that would generally
149 be considered "letters."]}
150 @end{Discussion}
151
152 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]}
153 @Chg{Version=[2],New=[@Defn{letter_uppercase}@ntf{letter_uppercase}],
154 Old=[@Defn{upper_case_identifier_letter}@ntf<upper_case_identifier_letter>]}@\Any
155 character @Chg{Version=[2],New=[whose General Category is defined
156 to be @lquotes@;Letter, Uppercase@rquotes@;],
157 Old=[of Row 00 of ISO 10646 BMP whose name begins
158 @lquotes@;Latin Capital Letter@rquotes@;]}.
159
160 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]}
161 @Chg{Version=[2],New=[@Defn{letter_lowercase}@ntf{letter_lowercase}],
162 Old=[@Defn{lower_case_identifier_letter}@ntf<lower_case_identifier_letter>]}@\Any
163 character @Chg{Version=[2],New=[whose General Category is defined
164 to be @lquotes@;Letter, Lowercase@rquotes@;],
165 Old=[of Row 00 of ISO 10646 BMP whose name begins
166 @lquotes@;Latin Small Letter@rquotes@;]}.
167 @begin{Honest}
168 @ChgRef{Version=[1],Kind=[Deleted],Ref=[8652/0001],ARef=[AI95-00124-01]}
169 @Comment{The change in clause 1.3 for 8652/0001 handles this problem.}
170 @ChgDeleted{Version=[1],Text=[The above rules do not include the ligatures
171 @latin1(198) and @latin1(230).
172 However, the intent is to include these characters as identifier letters.
173 This problem was pointed out by a comment from the Netherlands.]}
174 @end{Honest}
175
176 @ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]}
177 @ChgAdded{Version=[2],Text=[@Defn{letter_titlecase}@ntf{letter_titlecase}@\Any
178 character whose General Category is defined to be @lquotes@;Letter, Titlecase@rquotes@;.]}
179
180 @ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]}
181 @ChgAdded{Version=[2],Text=[@Defn{letter_modifier}@ntf{letter_modifier}@\Any
182 character whose General Category is defined to be @lquotes@;Letter, Modifier@rquotes@;.]}
183
184 @ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]}
185 @ChgAdded{Version=[2],Text=[@Defn{letter_other}@ntf{letter_other}@\Any
186 character whose General Category is defined to be @lquotes@;Letter, Other@rquotes@;.]}
187
188 @ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]}
189 @ChgAdded{Version=[2],Text=[@Defn{mark_non_spacing}@ntf{mark_non_spacing}@\Any
190 character whose General Category is defined to be @lquotes@;Mark, Non-Spacing@rquotes@;.]}
191
192 @ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]}
193 @ChgAdded{Version=[2],Text=[@Defn{mark_non_spacing}@ntf{mark_spacing_combining}@\Any
194 character whose General Category is defined to be @lquotes@;Mark, Spacing Combining@rquotes@;.]}
195
196 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]}
197 @Chg{Version=[2],New=[@Defn{number_decimal}@ntf{number_decimal}],
198 Old=[@Defn{digit}@nt{digit}]}@\@Chg{Version=[2],New=[Any
199 character whose General Category is defined
200 to be @lquotes@;Number, Decimal@rquotes@;],
201 Old=[One of the characters 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9]}.
202
203 @ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]}
204 @ChgAdded{Version=[2],Text=[@Defn{number_letter}@ntf{number_letter}@\Any
205 character whose General Category is defined to be @lquotes@;Number, Letter@rquotes@;.]}
206
207 @ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]}
208 @ChgAdded{Version=[2],Text=[@Defn{punctuation_connector}@ntf{punctuation_connector}@\Any
209 character whose General Category is defined to be @lquotes@;Punctuation, Connector@rquotes@;.]}
210
211 @ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]}
212 @ChgAdded{Version=[2],Text=[@Defn{other_format}@ntf{other_format}@\Any
213 character whose General Category is defined to be @lquotes@;Other, Format@rquotes@;.]}
214
215 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]}
216 @Chg{Version=[2],New=[@Defn{separator_space}@ntf<separator_space>],
217 Old=[@Defn{space_character}@ntf{space_character}]}@\@Chg{Version=[2],New=[Any
218 character whose General Category is defined to be @lquotes@;Separator,
219 Space@rquotes@;.],Old=[The character of ISO 10646 BMP named
220 @lquotes@;Space@rquotes@;.]}
221
222 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]}
223 @Chg{Version=[2],New=[@Defn{separator_line}@ntf{separator_line}],
224 Old=[@Defn{special_character}@ntf{special_character}]}@\Any character
225 @Chg{Version=[2],New=[whose General Category is defined to be
226 @lquotes@;Separator, Line@rquotes@;.],
227 Old=[of the ISO 10646 BMP that is not reserved for a control function, and
228 is not the @ntf<space_character>, an @ntf<identifier_letter>, or a @ntf<digit>.]}
229 @begin{Ramification}
230 @ChgRef{Version=[2],Kind=[DeletedNoDelMsg]}
231 @ChgDeleted{Version=[2],Text=[Note that the no break space and soft hyphen
232 are @ntf<special_character>s,
233 and therefore @nt<graphic_character>s.
234 They are not the same characters as space and hyphen-minus.]}
235 @end{Ramification}
236
237 @ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]}
238 @ChgAdded{Version=[2],Text=[@Defn{separator_paragraph}@ntf{separator_paragraph}@\Any
239 character whose General Category is defined to be @lquotes@;Separator, Paragraph@rquotes@;.]}
240
241 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]}
242 @Defn{format_effector}@ntf<format_effector>@\The
243 @Chg{Version=[2],New=[characters whose code positions are
244 16#09# (CHARACTER TABULATION), 16#0A# (LINE FEED), 16#0B# (LINE TABULATION),
245 16#0C# (FORM FEED), 16#0D# (CARRIAGE RETURN), 16#85# (NEXT LINE),
246 and the characters in categories @ntf{separator_line} and
247 @ntf{separator_paragraph}],
248 Old=[control functions of ISO 6429 called
249 character tabulation (HT), line tabulation (VT), carriage return (CR),
250 line feed (LF), and form feed (FF)]}.
251 @IndexSeeAlso{Term=[control character],See=(format_effector)}
252
253 @begin{Discussion}
254 @ChgRef{Version=[2],Kind=[AddedNormal]}
255 @ChgAdded{Version=[2],Text=[ISO/IEC 10646:2003 does not define the names
256 of control characters, but rather refers to the names defined by
257 ISO/IEC 6429:1992. These are the names that we use here.]}
258 @end{Discussion}
259
260 @ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]}
261 @ChgAdded{Version=[2],Text=[@Defn{other_control}@ntf{other_control}@\Any
262 character whose General Category is defined
263 to be @lquotes@;Other, Control@rquotes@;, and which is not defined to be a
264 @ntf<format_effector>.]}
265
266 @ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]}
267 @ChgAdded{Version=[2],Text=[@Defn{other_private_use}@ntf{other_private_use}@\Any
268 character whose General Category is defined to be @lquotes@;Other, Private Use@rquotes@;.]}
269
270 @ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]}
271 @ChgAdded{Version=[2],Text=[@Defn{other_surrogate}@ntf{other_surrogate}@\Any
272 character whose General Category is defined to be @lquotes@;Other, Surrogate@rquotes@;.]}
273
274 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01],ARef=[AI95-00395-01]}
275 @Chg{Version=[2],New=[@Defn{graphic_character}@ntf{graphic_character}],
276 Old=[@Defn{other_control_function}@ntf<other_control_function>]}@\@Chg{Version=[2],
277 New=[Any character that is not in the categories @ntf{other_control},
278 @ntf{other_private_use}, @ntf{other_surrogate},
279 @ntf{format_effector}, and whose relative code position in its plane is neither
280 16#FFFE# nor 16#FFFF#.],
281 Old=[Any control function,
282 other than a @ntf<format_effector>, that is allowed in a comment; the set of
283 @ntf<other_control_function>s allowed in comments is implementation defined.
284 @IndexSeeAlso{Term=[control character],See=(other_control_function)}]}
285 @ChgImplDef{Version=[2],Kind=[Deleted],Text=[@ChgDeleted{Version=[2],Text=[The
286 control functions allowed in comments.]}]}
287
288 @begin{Discussion}
289 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]}
290 @ChgAdded{Version=[2],Text=`We considered basing the definition of
291 lexical elements on Annex A of ISO/IEC
292 TR 10176 (4th edition), which lists the characters which should be supported in
293 identifiers for all programming languages, but we finally decided against this
294 option. Note that it is not our intent to diverge from ISO/IEC TR 10176,
295 except to the extent that ISO/IEC TR 10176 itself diverges from ISO/IEC
296 10646:2003 (which is the case at the time of this writing [January 2005]).'}
297
298 @ChgRef{Version=[2],Kind=[AddedNormal]}
299 @ChgAdded{Version=[2],Type=[Leading],Text=[More precisely, we intend to align
300 strictly with ISO/IEC 10646:2003. It must be
301 noted that ISO/IEC TR 10176 is a Technical Report while ISO/IEC 10646:2003 is a
302 Standard. If one has to make a choice, one should conform with the Standard
303 rather than with the Technical Report. And, it turns out that one @i<must>
304 make a choice because there are important differences between the two:]}
305
306 @begin{Itemize}
307 @ChgRef{Version=[2],Kind=[AddedNormal]}
308 @ChgAdded{Version=[2],Text=[ISO/IEC TR 10176 is still based on
309 ISO/IEC 10646:2000 while ISO/IEC 10646:2003 has already been published
310 for a year. We cannot afford to delay
311 the adoption of our amendment until ISO/IEC TR 10176 has been revised.]}
312
313 @ChgRef{Version=[2],Kind=[AddedNormal]}
314 @ChgAdded{Version=[2],Text=[There are considerable differences between the
315 two editions of ISO/IEC 10646,
316 notably in supporting characters beyond the BMP (this might be significant for
317 some languages, e.g. Korean).]}
318
319 @ChgRef{Version=[2],Kind=[AddedNormal]}
320 @ChgAdded{Version=[2],Text=[ISO/IEC TR 10176 does not define case conversion
321 tables, which are essential
322 for a case-insensitive language like Ada. To get case conversion tables, we
323 would have to reference either ISO/IEC 10646:2003 or Unicode, or we would have
324 to invent our own.]}
325 @end{Itemize}
326
327 @ChgRef{Version=[2],Kind=[AddedNormal]}
328 @ChgAdded{Version=[2],Type=[Leading],Text=[For the purpose of defining the
329 lexical elements of the language, we need
330 character properties like categorization, as well as case conversion tables.
331 These are mentioned in ISO/IEC 10646:2003 as useful for implementations, with a
332 reference to Unicode. Machine-readable tables are available on the web at URLs:]}
333 @begin{Example}
334 @ChgRef{Version=[2],Kind=[AddedNormal]}
335 @ChgAdded{Version=[2],Text=[@URLLink{URL=[http://www.unicode.org/Public/4.0-Update/UnicodeData-4.0.0.txt],
336 Text=[http://www.unicode.org/Public/4.0-Update/UnicodeData-4.0.0.txt]}
337 @URLLink{URL=[http://www.unicode.org/Public/4.0-Update/CaseFolding-4.0.0.txt],
338 Text=[http://www.unicode.org/Public/4.0-Update/CaseFolding-4.0.0.txt]}]}
339 @end{Example}
340
341 @ChgRef{Version=[2],Kind=[AddedNormal]}
342 @ChgAdded{Version=[2],Type=[Leading],Text=[with an explanatory document found at URL:]}
343 @begin{Example}
344 @ChgRef{Version=[2],Kind=[AddedNormal]}
345 @ChgAdded{Version=[2],Text=[@URLLink{URL=[http://www.unicode.org/Public/4.0-Update/UCD-4.0.0.html],
346 Text=[http://www.unicode.org/Public/4.0-Update/UCD-4.0.0.html]}]}
347 @end{Example}
348
349 @ChgRef{Version=[2],Kind=[AddedNormal]}
350 @ChgAdded{Version=[2],Text=[The actual text of the standard only makes
351 specific references to the
352 corresponding clauses of ISO/IEC 10646:2003, not to Unicode.]}
353
354 @end{Discussion}
355 @end{Description}
356
357 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]}
358 @Leading@Chg{Version=[2],New=[],Old=[@Defn{names of @ntf{special_character}s}
359 @Defn2{Term=[special_character],Sec=(names)}]}The
360 following names are used when referring to certain
361 @Chg{Version=[2],New=[characters (the first name is that given in
362 ISO/IEC 10646:2003)],Old=[@ntf{special_character}s]}:
363 @Defn{quotation mark}
364 @Defn{number sign}
365 @Defn{ampersand}
366 @Defn{apostrophe}
367 @Defn{tick}
368 @Defn{left parenthesis}
369 @Defn{right parenthesis}
370 @Defn{asterisk}
371 @Defn{multiply}
372 @Defn{plus sign}
373 @Defn{comma}
374 @Defn{hyphen-minus}
375 @Defn{minus}
376 @Defn{full stop}
377 @Defn{dot}
378 @Defn{point}
379 @Defn{solidus}
380 @Defn{divide}
381 @Defn{colon}
382 @Defn{semicolon}
383 @Defn{less-than sign}
384 @Defn{equals sign}
385 @Defn{greater-than sign}
386 @Defn{low line}
387 @Defn{underline}
388 @Defn{vertical line}
389 @Chg{Version=[2],New=[@Defn{exclamation point}
390 @Defn{percent sign}],
391 Old=[@Defn{left square bracket}
392 @Defn{right square bracket}
393 @Defn{left curly bracket}
394 @Defn{right curly bracket}]}
395 @begin{Discussion}
396 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]}
397 @Chg{Version=[2],New=[@Defn{graphic symbols}@Defn{glyphs}This table
398 serves to show the correspondence between
399 ISO/IEC 10646:2003 names and the graphic symbols (glyphs) used in this
400 International Standard. These are the characters],
401 Old=[These are the ones]}
402 that play a special role in the syntax of Ada@Chg{Version=[2],New=[],
403 Old=[ 95, or in the syntax rules;
404 we don't bother to define names for all characters.
405 The first name given is the name from ISO 10646-1; the subsequent
406 names, if any, are those used within the
407 standard, depending on context]}.
408 @end{Discussion}
409 @Comment{The original version follows here (commented out)
410 @begin{Display}
411 @TabClear()@TabSet(P9)
412 @begin(TwoCol)
413 @NoParanum@;symbol @\name
414
415 @NoParanum@; " @\quotation mark
416 # @\number sign
417 & @\ampersand
418 ' @\apostrophe, tick
419 ( @\left parenthesis
420 ) @\right parenthesis
421 * @\asterisk, multiply
422 + @\plus sign
423 , @\comma
424 @en@; @\hyphen-minus, minus
425 . @\full stop, dot, point
426 / @\solidus, divide
427 @NewColumn
428 @NoParanum@;symbol @\name
429
430 @NoParanum@; : @\colon
431 ; @\semicolon
432 < @\less-than sign
433 = @\equals sign
434 > @\greater-than sign
435 _ @\low line, underline
436 | @\vertical line
437 [ @\left square bracket
438 ] @\right square bracket
439 { @\left curly bracket
440 } @\right curly bracket
441 @end(TwoCol)
442 @end{Display}}
443 @Comment{We use this (weird) four column version to make the HTML look much better.
444 WARNING: The items that go together are in separate columns!!}
445 @begin(FourCol)
446 @NoParanum@;@ @ @Chg{Version=[2],New=[graphic ],Old=[@ @ @ @ ]}symbol
447
448 @NoParanum@;@ @ @ @ @ @ @ @ @ "@*
449 @ @ @ @ @ @ @ @ @ #@*
450 @ @ @ @ @ @ @ @ @ &@*
451 @ @ @ @ @ @ @ @ @ '@*
452 @ @ @ @ @ @ @ @ @ (@*
453 @ @ @ @ @ @ @ @ @ )@*
454 @ @ @ @ @ @ @ @ @ *@*
455 @ @ @ @ @ @ @ @ @ +@*
456 @ @ @ @ @ @ @ @ @ ,@*
457 @ @ @ @ @ @ @ @ @ @en@;@*
458 @ @ @ @ @ @ @ @ @ .@Chg{Version=[2],New=[],Old=[@*]}@Chg{Version=[2],New=[],Old=[@ @ @ @ @ @ @ @ @ /]}@ChgNote{Funny layout so HTML and RTF look right}
459 @NewColumn
460 @NoParanum@;name
461
462 @NoParanum@;quotation mark@*
463 number sign@*
464 ampersand@*
465 apostrophe, tick@*
466 left parenthesis@*
467 right parenthesis@*
468 asterisk, multiply@*
469 plus sign@*
470 comma@*
471 hyphen-minus, minus@*
472 full stop, dot, point@Chg{Version=[2],New=[],Old=[@*]}@Chg{Version=[2],New=[],Old=[solidus, divide]}@ChgNote{Funny layout so HTML and RTF look right}
473
474 @NewColumn
475 @NoParanum@;@ @ @Chg{Version=[2],New=[graphic ],Old=[@ @ @ @ ]}symbol
476
477 @NoParanum@;@ @ @ @ @ @ @ @ @ :@*
478 @ @ @ @ @ @ @ @ @ ;@*
479 @ @ @ @ @ @ @ @ @ <@*
480 @ @ @ @ @ @ @ @ @ =@*
481 @ @ @ @ @ @ @ @ @ >@*
482 @ @ @ @ @ @ @ @ @ _@*
483 @ @ @ @ @ @ @ @ @ |@*
484 @ @ @ @ @ @ @ @ @ @Chg{Version=[2],New=[/],Old=<[>}@*
485 @ @ @ @ @ @ @ @ @ @Chg{Version=[2],New=[!],Old=<]>}@*
486 @ @ @ @ @ @ @ @ @ @Chg<Version=[2],New=[%],Old=<{>>@*
487 @Chg<Version=[2],New=[],Old=<@ @ @ @ @ @ @ @ @ }>>
488 @NewColumn
489 @NoParanum@;name
490
491 @NoParanum@;colon@*
492 semicolon@*
493 less-than sign@*
494 equals sign@*
495 greater-than sign@*
496 low line, underline@*
497 vertical line@*
498 @Chg{Version=[2],New=[solidus, divide],Old=[left square bracket]}@*
499 @Chg{Version=[2],New=[exclamation point],Old=[right square bracket]}@*
500 @Chg{Version=[2],New=[percent sign],Old=[left curly bracket]}@*
501 @Chg{Version=[2],New=[],Old=[right curly bracket]}
502 @end(FourCol)
503 @end{StaticSem}
504
505 @begin{ImplPerm}
506 @ChgRef{Version=[2],Kind=[Deleted],ARef=[AI95-00285-01]}
507 @ChgDeleted{Version=[2],Text=[In a nonstandard mode, the implementation
508 may support a different character repertoire@Redundant[; in particular,
509 the set of characters that are considered @ntf<identifier_letter>s
510 can be extended
511 or changed to conform to local conventions].]}
512 @begin{Ramification}
513 @ChgRef{Version=[2],Kind=[DeletedNoDelMsg]}
514 @ChgDeleted{Version=[2],Text=[If an implementation supports
515 other character sets,
516 it defines which characters fall into each category,
517 such as @lquotes@;@ntf{identifier_letter},@rquotes@;
518 and what the corresponding rules of this section are,
519 such as which characters are allowed in the text of a program.]}
520 @end{Ramification}
521 @end{ImplPerm}
522
523 @begin{Notes}
524 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]}
525 @Chg{Version=[2],New=[The characters in categories @ntf{other_control},
526 @ntf{other_private_use}, and @ntf{other_surrogate} are only allowed in comments],
527 Old=[Every code position of ISO 10646 BMP that is not reserved for a control
528 function is defined to be a @nt<graphic_character> by this International Standard.
529 This includes all code positions other than 0000 - 001F, 007F - 009F,
530 and FFFE - FFFF]}.
531
532 The language does not specify the source representation of programs.
533 @begin(Discussion)
534 @ChgRef{Version=[2],Kind=[Revised]}
535 Any source representation is valid so long as the
536 implementer can produce an (information-preserving)
537 algorithm for translating both directions
538 between the representation and the standard character set.
539 (For example, every character in the standard character set has to be
540 representable, even if the output devices attached to a given computer
541 cannot print all of those characters properly.)
542 From a practical point of view, every implementer will have to provide
543 some way to process the @Chg{Version=[2],New=[ACATS],Old=[ACVC]}.
544 It is the intent to allow source representations, such as parse trees,
545 that are not even linear sequences of characters.
546 It is also the intent to allow different fonts:
547 reserved words might be in bold face,
548 and that should be irrelevant to the semantics.
549 @end(Discussion)
550 @end{Notes}
551
552 @begin{Extend83}
553 @Defn{extensions to Ada 83}
554 Ada 95 allows 8-bit and 16-bit characters,
555 as well as implementation-specified character sets.
556 @end{Extend83}
557
558 @begin{DiffWord83}
559 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]}
560 The syntax rules in this clause are modified to remove the emphasis
561 on basic characters vs. others.
562 (In this day and age, there is no need to point out that you can write
563 programs without using (for example) lower case letters.)
564 In particular, @ntf{character} (representing all characters usable outside
565 comments) is added, and @ntf{basic_graphic_character},
566 @ntf{other_special_character},
567 and @ntf{basic_character} are removed.
568 @ntf{Special_character} is expanded to include Ada 83's
569 @ntf{other_special_character}, as well as new 8-bit characters not
570 present in Ada 83.@Chg{Version=[2],New=[ Ada 2005 removes
571 @ntf{special_character} altogether; we want to stick to ISO/IEC 10646:2003
572 character classifications.],Old=[]}
573 Note that the term @lquotes@;basic letter@rquotes@; is used
574 in @RefSec{Character Handling}
575 to refer to letters without diacritical marks.
576
577 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]}
578 Character names now come from
579 @Chg{Version=[2],New=[ISO/IEC 10646:2003],Old=[ISO 10646]}.
580
581 @ChgRef{Version=[2],Kind=[Deleted],ARef=[AI95-00285-01]}
582 @ChgDeleted{Version=[2],Text=[We use @ntf<identifier_letter> rather than
583 @ntf<letter> since ISO 10646 BMP includes many "letters' that are not
584 permitted in identifiers (in the standard mode).]}
585 @end{DiffWord83}
586
587 @begin{Extend95}
588 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01],ARef=[AI95-00395-01]}
589 @ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95}
590 Program text can use most characters defined by ISO-10646:2003. This
591 clause has been rewritten to use the categories defined in that Standard.
592 This should ease programming in languages other than English.]}
593 @end{Extend95}
594
595
596 @LabeledClause{Lexical Elements, Separators, and Delimiters}
597
598 @begin{StaticSem}
599 @Defn{text of a program}
600 The text of a program consists of the texts of one or more
601 @nt<compilation>s.
602 @Defn{lexical element}
603 @IndexSee{Term=[token],See=(lexical element)}
604 The text of each @nt<compilation> is a sequence
605 of separate @i(lexical elements).
606 Each lexical element is formed from a
607 sequence of characters, and is
608 either a delimiter, an @nt<identifier>, a reserved word,
609 a @nt<numeric_literal>, a @nt<character_literal>, a @nt<string_literal>,
610 or a comment.
611 The meaning of a program depends only on the particular sequences of
612 lexical elements that form its @nt{compilation}s, excluding
613 @nt{comment}s.
614
615 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]}
616 The text of a @nt<compilation> is divided into @Defn{line}@i{lines}.
617 @Defn{end of a line}
618 In general, the representation for an end of line is implementation defined.
619 However, a sequence of one or more @ntf<format_effector>s other
620 than @Chg{Version=[2],New=[the character whose code position
621 is 16#09# (CHARACTER TABULATION)],Old=[character tabulation (HT)]}
622 signifies at least one end of line.
623 @ImplDef{The representation for an end of line.}
624
625 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]}
626 @Leading@Defn{separator}
627 @Redundant[In some cases an explicit @i(separator) is required
628 to separate adjacent lexical elements.]
629 A separator is
630 any of a @Chg{Version=[2],New=[@ntf{separator_space}],Old=[space character]},
631 a @Chg{Version=[2],New=[@ntf{format_effector}],Old=[format effector]},
632 or the end of a line, as follows:
633 @begin(Discussion)
634 @ChgRef{Version=[2],Kind=[DeletedNoDelMsg]}
635 @ChgDeleted{Version=[2],Text=[It might be useful to define @lquotes@;white space@rquotes@;
636 and use it here.]}@ChgNote{No one can figure out why, and it wouldn't match the
637 Unicode def of whitespace.}
638 @end(Discussion)
639 @begin{Itemize}
640 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]}
641 A @Chg{Version=[2],New=[@ntf{separator_space}],Old=[space character]} is
642 a separator except within a @nt{comment}, a @nt{string_literal},
643 or a @nt{character_literal}.
644
645 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]}
646 @Chg{Version=[2],New=[The character whose code position
647 is 16#09# (CHARACTER TABULATION)],Old=[Character tabulation (HT)]} is a
648 separator except within a @nt{comment}.
649
650 The end of a line is always a separator.
651 @end{Itemize}
652
653 One or more separators are allowed between any two adjacent lexical
654 elements, before the first of each @nt{compilation}, or after the
655 last.
656 At least one separator is required between an @nt{identifier},
657 a reserved word, or a @nt{numeric_literal} and an adjacent
658 @nt{identifier}, reserved word, or @nt{numeric_literal}.
659
660 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]}
661 @Defn{delimiter}
662 A @i{delimiter} is either one of the following@Chg{Version=[2],New=[],Old=[ special]}
663 characters@Chg{Version=[2],New=[:],Old=[]}
664 @begin{Display}
665 &@ @ @ @ '@ @ @ @ (@ @ @ @ )@ @ @ @ *@ @ @ @ +@ @ @ @ ,@ @ @ @ @en@ @ @ @ .@ @ @ @ /@ @ @ @ :@ @ @ @ ;@ @ @ @ <@ @ @ @ =@ @ @ @ >@ @ @ @ |
666 @end{Display}
667
668 @Defn{compound delimiter}
669 or one of the following @i{compound delimiters} each composed of two
670 adjacent special characters
671 @begin{Display}
672 =>@ @ @ @ ..@ @ @ @ **@ @ @ @ :=@ @ @ @ /=@ @ @ @ >=@ @ @ @ <=@ @ @ @ <<@ @ @ @ >>@ @ @ @ <>
673 @end{Display}
674
675 Each of the special characters listed for single character delimiters
676 is a single delimiter except if this character is used as a character
677 of a compound delimiter, or as a character of a @nt{comment},
678 @nt{string_literal}, @nt{character_literal}, or
679 @nt{numeric_literal}.
680
681 @rmnewpage@ChgNote{Ada 2005 only}
682 @Leading@keepnext@;The following names are used when referring to compound
683 delimiters:@table{Columns=[2],
684 Alignment=[Allleft],FirstColWidth=[1],LastColWidth=[4],
685 NoBreak=[F],Border=[F],SmallSize=[F],Caption=[],
686 Headers=[delimiter@ @\name],
687 Body=[=>@\arrow
688 ..@\double dot
689 **@\double star, exponentiate
690 :=@\assignment (pronounced: @lquotes@;becomes@rquotes@;)
691 /=@\inequality (pronounced: @lquotes@;not equal@rquotes@;)
692 >=@\greater than or equal
693 <=@\less than or equal
694 <<@\left label bracket
695 >>@\right label bracket
696 <>@\box]}
697 @end{StaticSem}
698
699 @begin{ImplReq}
700 An implementation shall support lines of
701 at least 200 characters in length, not counting any characters used to signify
702 the end of a line.
703 An implementation shall support lexical elements of at least
704 200 characters in length.
705 The maximum supported line length and lexical element length are
706 implementation defined.
707 @ImplDef{Maximum supported line length and lexical element length.}
708 @begin{Discussion}
709 From URG recommendation.
710 @end{Discussion}
711 @end{ImplReq}
712
713 @begin{Diffword95}
714 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]}
715 @ChgAdded{Version=[2],Text=[The wording was updated to use the new character
716 categories defined in the preceding clause.]}
717 @end{Diffword95}
718
719
720 @LabeledClause{Identifiers}
721
722 @begin{Intro}
723 @nt<Identifier>s are used as names.
724 @end{Intro}
725
726 @begin{Syntax}
727 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01],ARef=[AI95-00395-01]}
728 @Syn{lhs=<identifier>,rhs="
729 @Chg{Version=[2],New=<@Syn2{identifier_start} {@Syn2{identifier_start} | @Syn2{identifier_extend}}>,
730 Old=<@Synf{identifier_letter} {[@Synf{underline}] @Syn2{letter_or_digit}}>}"}
731
732 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01],ARef=[AI95-00395-01]}
733 @Syn{lhs=<@Chg{Version=[2],New=<identifier_start>,Old=<letter_or_digit>}>,
734 rhs="@Chg{Version=[2],New=<
735 @Synf{letter_uppercase}
736 | @Synf{letter_lowercase}
737 | @Synf{letter_titlecase}
738 | @Synf{letter_modifier}
739 | @Synf{letter_other}
740 | @Synf{number_letter}>,Old=<@Synf{identifier_letter} | @Synf{digit}>}"}
741
742 @ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01],ARef=[AI95-00395-01]}
743 @AddedSyn{Version=[2],lhs=<@Chg{Version=[2],New=<identifier_extend>,Old=<>}>,
744 rhs="@Chg{Version=[2],New=<
745 @Synf{mark_non_spacing}
746 | @Synf{mark_spacing_combining}
747 | @Synf{number_decimal}
748 | @Synf{punctuation_connector}
749 | @Synf{other_format}>,Old=<>}"}
750
751 @begin{SyntaxText}
752 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00395-01]}
753 @Chg{Version=[2],New=[After eliminating the characters in category
754 @ntf{other_format}, an @nt{identifier} shall not contain two consecutive
755 characters in category punctuation_connector, or end with a character
756 in that category.],Old=[An @nt{identifier} shall not be a reserved word.]}
757 @begin{Reason}
758 @ChgRef{Version=[2],Kind=[AddedNormal]}
759 @ChgAdded{Version=[2],Text=[This rule was stated in the syntax in Ada 95,
760 but that has gotten too complex in Ada 2005. Since @ntf{other_format}
761 characters usually do not display, we do not want to count them as separating
762 two underscores.]}
763 @end{Reason}
764 @end{SyntaxText}
765 @end{Syntax}
766
767 @begin{StaticSem}
768 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]}
769 @ChgAdded{Version=[2],Type=[Leading],Text=[Two @nt{identifier}s are ]}@Chg{Version=[2],
770 New=[considered the same if they consist of the same sequence of characters
771 after applying the following transformations (in this order):],Old=[All
772 characters of an @nt{identifier} are significant, including any
773 underline character.
774 @Defn{case insensitive}
775 @nt{Identifier}s differing only in the use of
776 corresponding upper and lower case letters are considered the same.]}
777 @begin{Itemize}
778 @ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]}
779 @ChgAdded{Version=[2],Text=[The characters in category @ntf{other_format}
780 are eliminated.]}
781
782 @ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01],ARef=[AI95-00395-01]}
783 @ChgAdded{Version=[2],Text=[The remaining sequence of characters is
784 converted to upper case.
785 @Defn{case insensitive}]}
786 @end{Itemize}
787 @begin(Discussion)
788 @ChgRef{Version=[2],Kind=[DeletedNoDelMsg]}
789 @ChgDeleted{Version=[2],Text=[Two of the letters of ISO 8859-1
790 appear only as lower case,
791 "sharp s" and "y with diaeresis." These two letters have
792 no corresponding upper case letter (in particular, they
793 are not considered equivalent to one another).]}
794 @end(Discussion)
795 @ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00395-01]}
796 @ChgAdded{Version=[2],Text=[After applying these transformations, an
797 @nt{identifier} shall not be identical to a reserved word (in upper case).]}
798 @begin(ImplNote)
799 @ChgRef{Version=[2],Kind=[AddedNormal]}
800 @ChgAdded{Version=[2],Text=[We match the reserved words after doing these
801 transformations so that the rules for @nt{identifier}s and reserved words are
802 the same. (This allows @ntf{other_format} characters, which usually don't
803 display, in a reserved word without changing it to an @nt{identifier}.) Since
804 a compiler usually will lexically process @nt{identifier}s and reserved words the
805 same way (often with the same code), this will prevent a lot of headaches.]}
806 @end(ImplNote)
807 @begin(Ramification)
808 @ChgRef{Version=[2],Kind=[AddedNormal]}
809 @ChgAdded{Version=[2],Text=[The rules for reserved words differ in one way:
810 they define case conversion on letters rather than sequences. This means that
811 some unusual sequences are neither @nt{identifier}s nor reserved words.
812 For instance, @lquotes@;@smldotlessi@;f@rquotes@; and
813 @lquotes@;acce@latin1(223)@rquotes@; have upper case conversions of
814 @lquotes@;IF@rquotes@; and @lquotes@;ACCESS@rquotes@; respectively.
815 These are not @nt{identifier}s, because the transformed values are identical
816 to a reserved word. But they are not reserved words, either, because the
817 original values do not match any reserved word as defined or with any number
818 of characters of the reserved word in upper case. Thus, these odd
819 constructions are just illegal, and should not appear in the source of
820 a program.]}
821 @end(Ramification)
822 @end{StaticSem}
823
824 @begin{ImplPerm}
825 In a nonstandard mode,
826 an implementation may support other upper/lower case equivalence
827 rules for @nt<identifier>s@Redundant[,
828 to accommodate local conventions].
829 @end{ImplPerm}
830
831 @begin(Discussion)
832 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]}
833 @ChgAdded{Version=[2],Type=[Leading],Text=[For instance, in most languages,
834 the uppercase
835 equivalent of LATIN SMALL LETTER I (a lower case letter with a dot above) is
836 LATIN CAPITAL LETTER I (an upper case letter without a dot above). In
837 Turkish, though, LATIN SMALL LETTER I and LATIN SMALL LETTER DOTLESS I are
838 two distinct letters, so the upper case equivalent of LATIN SMALL LETTER I is
839 LATIN CAPITAL LETTER I WITH DOT ABOVE, and the upper case equivalent of LATIN
840 SMALL LETTER DOTLESS I is LATIN CAPITAL LETTER I. Take for instance the
841 following identifier (which is the name of a city on the Tigris river in
842 Eastern Anatolia):]}
843 @begin{Example}
844 @ChgRef{Version=[2],Kind=[AddedNormal]}
845 @ChgAdded{Version=[2],Text=[diyarbak@smldotlessi@;r -- @RI[The first i is dotted, the second isn't.]]}
846 @end{Example}
847 @ChgRef{Version=[2],Kind=[AddedNormal]}
848 @ChgAdded{Version=[2],Type=[Leading],Text=[Locale-independent conversion to
849 upper case results in:]}
850 @begin{Example}
851 @ChgRef{Version=[2],Kind=[AddedNormal]}
852 @ChgAdded{Version=[2],Text=[DIYARBAKIR -- @RI[Both Is are dotless.]]}
853 @end{Example}
854 @ChgRef{Version=[2],Kind=[AddedNormal]}
855 @ChgAdded{Version=[2],Type=[Leading],Text=[This means that the four following
856 sequences of characters represent the same identifier, even though for a
857 locutor of Turkish they would probably be considered distinct words:]}
858 @begin{Example}
859 @ChgRef{Version=[2],Kind=[AddedNormal]}
860 @ChgAdded{Version=[2],Text=[diyarbakir
861 diyarbak@smldotlessi@;r
862 d@smldotlessi@;yarbakir
863 d@smldotlessi@;yarbak@smldotlessi@;r]}
864 @end{Example}
865 @ChgRef{Version=[2],Kind=[AddedNormal]}
866 @ChgAdded{Version=[2],Type=[Leading],Text=[An implementation targeting the
867 Turkish market is allowed (in fact, expected) to provide a nonstandard mode
868 where case folding is appropriate for Turkish. This would cause the original
869 identifier to be converted to:]}
870 @begin{Example}
871 @ChgRef{Version=[2],Kind=[AddedNormal]}
872 @ChgAdded{Version=[2],Text=[D@capdottedi@;YARBAKIR -- @RI[The first I is dotted, the second isn't.]]}
873 @end{Example}
874 @ChgRef{Version=[2],Kind=[AddedNormal]}
875 @ChgAdded{Version=[2],Text=[and the four sequences of characters shown above
876 would represent four distinct identifiers.]}
877
878 @ChgRef{Version=[2],Kind=[AddedNormal]}
879 @ChgAdded{Version=[2],Text=[Lithuanian and Azeri are two other languages that
880 present similar idiosyncrasies.]}
881 @end{Discussion}
882
883 @begin{Notes}
884 @ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]}
885 @ChgAdded{Version=[2],Text=[@nt{Identifier}s differing only in the use of
886 corresponding upper and lower case letters are considered the same.]}
887 @end{Notes}
888
889 @begin{Examples}
890 @Leading@keepnext@i{Examples of identifiers:}
891 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00433-01]}
892 @ChgNote{Old version:@begin{Display}
893 Count X Get_Symbol Ethelyn Marion
894 @Comment{Blank line}
895 Snobol_4 X1 Page_Count Store_Next_Item
896 @end{Display}}
897 @begin{Example}
898 Count X Get_Symbol Ethelyn Marion
899 Snobol_4 X1 Page_Count Store_Next_Item@Chg{Version=[2],New=[
900 @unicode(928)@unicode(955)@unicode(940)@unicode(964)@unicode(969)@unicode(957) --@RI[ Plato]
901 @unicode(1063)@unicode(1072)@unicode(1081)@unicode(1082)@unicode(1086)@unicode(1074)@unicode(1089)@unicode(1082)@unicode(1080)@unicode(1081) --@RI[ Tchaikovsky]
902 @unicode(952) @unicode(966) --@RI[ Angles]],Old=[]}
903 @end{Example}
904 @end{Examples}
905
906 @begin{DiffWord83}
907 We no longer include reserved words as @nt<identifier>s.
908 This is not a language change.
909 In Ada 83, @nt{identifier} included reserved words.
910 However, this complicated several other
911 rules (for example, regarding implementation-defined
912 attributes and pragmas, etc.).
913 We now explicitly allow certain reserved words for attribute designators,
914 to make up for the loss.
915 @begin{Ramification}
916 Because syntax rules are relevant to overload resolution,
917 it means that if it looks like a reserved word,
918 it is not an @nt<identifier>.
919 As a side effect, implementations cannot use reserved words as
920 implementation-defined attributes or pragma names.
921 @end{Ramification}
922 @end{DiffWord83}
923
924 @begin{Extend95}
925 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]}
926 @ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95}
927 An @nt{identifier} can use any letter defined by ISO-10646:2003, along
928 with several other categories. This should ease programming in languages
929 other than English.]}
930 @end{Extend95}
931
932
933 @LabeledClause{Numeric Literals}
934
935 @begin{Intro}
936 @Defn2{Term=[literal], Sec=(numeric)}
937 There are two kinds of @nt<numeric_literal>s, @i(real literals) and @i(integer
938 literals).
939 @Defn{real literal}
940 A real literal is a @nt{numeric_literal} that includes a point;
941 @Defn{integer literal}
942 an integer literal is a @nt{numeric_literal} without a point.
943 @end{Intro}
944
945 @begin{Syntax}
946 @Syn{lhs=<numeric_literal>,rhs="@Syn2{decimal_literal} | @Syn2{based_literal}"}
947 @end{Syntax}
948
949 @begin{Notes}
950 The type of an integer literal is @i{universal_integer}.
951 The type of a real literal is @i{universal_real}.
952 @end{Notes}
953
954 @LabeledSubClause{Decimal Literals}
955
956 @begin{Intro}
957 @Defn2{Term=[literal], Sec=(decimal)}
958 A @nt<decimal_literal> is a @nt<numeric_literal> in the conventional
959 decimal notation (that is, the base is ten).
960 @end{Intro}
961
962 @begin{Syntax}
963 @Syn{lhs=<decimal_literal>,rhs="@Syn2{numeral} [.@Syn2{numeral}] [@Syn2{exponent}]"}
964
965
966 @Syn{lhs=<numeral>,rhs="@Syn2{digit} {[@Synf{underline}] @Syn2{digit}}"}
967
968 @Syn{lhs=<exponent>,rhs="E [+] @Syn2{numeral} | E @en@; @Syn2{numeral}"}
969
970 @ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]}
971 @AddedSyn{Version=[2],lhs=<@Chg{Version=[2],New=<digit>,Old=<>}>,
972 rhs="@Chg{Version=[2],New=<0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9>,Old=<>}"}
973
974 @begin{SyntaxText}
975 An @nt{exponent} for an integer literal shall not have a minus sign.
976 @begin{Ramification}
977 Although
978 this rule is in this subclause, it applies also to the next subclause.
979 @end{Ramification}
980 @end{SyntaxText}
981 @end{Syntax}
982
983 @begin{StaticSem}
984 An underline character in a
985 @nt{numeric_literal} does not affect its meaning.
986 The letter E of an @nt{exponent} can be written either in lower
987 case or in upper case, with the same meaning.
988 @begin{Ramification}
989 Although these rules are in this subclause,
990 they apply also to the next subclause.
991 @end{Ramification}
992
993 An @nt{exponent} indicates the power of ten by which the value of the
994 @nt{decimal_literal} without the @nt{exponent} is to be multiplied to
995 obtain the value of the @nt{decimal_literal} with the @nt{exponent}.
996 @end{StaticSem}
997
998 @begin{Examples}
999 @Leading@keepnext@i{Examples of decimal literals:}
1000 @ChgNote{ Old version: @begin{Display}
1001 @tabclear()@tabset(P31)
1002 12 0 1E6 123_456 @\--@i{ integer literals}
1003 @Comment{Blank line}
1004 12.0 0.0 0.456 3.14159_26 @\--@i{ real literals}
1005 @end{Display}}
1006 @begin{Example}
1007 12 0 1E6 123_456 --@RI{ integer literals}
1008 @Comment{Blank line}
1009 12.0 0.0 0.456 3.14159_26 --@RI{ real literals}
1010 @end{Example}
1011 @end{Examples}
1012
1013 @begin{DiffWord83}
1014 We have changed the syntactic category name @ntf{integer} to be @nt{numeral}.
1015 We got this idea from ACID.
1016 It avoids the confusion between this and integers.
1017 (Other places don't offer similar confusions.
1018 For example, a @nt{string_literal} is different from a string.)
1019 @end{DiffWord83}
1020
1021 @LabeledSubClause{Based Literals}
1022
1023 @begin{Intro}
1024 @Redundant[
1025 @Defn2{Term=[literal], Sec=(based)}
1026 @Defn{binary literal}
1027 @Defn{base 2 literal}
1028 @Defn2{Term=[binary], Sec=(literal)}
1029 @Defn{octal literal}
1030 @Defn{base 8 literal}
1031 @Defn2{Term=[octal], Sec=(literal)}
1032 @Defn{hexadecimal literal}
1033 @Defn{base 16 literal}
1034 @Defn2{Term=[hexadecimal], Sec=(literal)}
1035 A @nt<based_literal> is a @nt<numeric_literal> expressed in a form
1036 that specifies the base explicitly.]
1037 @end{Intro}
1038
1039 @begin{Syntax}
1040 @Syn{lhs=<based_literal>,rhs="
1041 @Syn2{base} # @Syn2{based_numeral} [.@Syn2{based_numeral}] # [@Syn2{exponent}]"}
1042
1043
1044 @Syn{lhs=<base>,rhs="@Syn2{numeral}"}
1045
1046 @Syn{lhs=<based_numeral>,rhs="
1047 @Syn2{extended_digit} {[@Synf{underline}] @Syn2{extended_digit}}"}
1048
1049 @Syn{lhs=<extended_digit>,rhs="@Syn2{digit} | A | B | C | D | E | F"}
1050
1051 @end{Syntax}
1052
1053 @begin{Legality}
1054 @Defn{base}
1055 The @i(base) (the numeric value of the decimal @nt<numeral> preceding
1056 the first #) shall be at least two and at most sixteen.
1057 The @nt{extended_digit}s A through F represent the digits ten through
1058 fifteen, respectively.
1059 The value of each @nt{extended_digit} of a @nt{based_literal}
1060 shall be less than the base.
1061 @end{Legality}
1062
1063 @begin{StaticSem}
1064 The conventional meaning of based notation is assumed.
1065 An @nt{exponent} indicates the
1066 power of the base by which the value of the @nt{based_literal}
1067 without the @nt{exponent} is to be multiplied to obtain the value of
1068 the @nt{based_literal} with the @nt{exponent}.
1069 The @nt{base} and the @nt{exponent}, if any, are in decimal notation.
1070
1071 The @nt{extended_digit}s A through F can be written either in
1072 lower case or in upper case, with the same meaning.
1073 @end{StaticSem}
1074
1075 @begin{Examples}
1076 @Leading@keepnext@i{Examples of based literals:}
1077 @ChgNote{ Old version: @begin{Display}
1078 @tabclear()@tabset(P16, P45)
1079 2#1111_1111# @\16#FF# 016#0ff# @\--@i{ integer literals of value 255}
1080 16#E#E1 @\2#1110_0000# @\--@i{ integer literals of value 224}
1081 16#F.FF#E+2 @\2#1.1111_1111_1110#E11 @\--@i{ real literals of value 4095.0}
1082 @end{Display}}
1083 @begin{Example}
1084 2#1111_1111# 16#FF# 016#0ff# --@RI{ integer literals of value 255}
1085 16#E#E1 2#1110_0000# --@RI{ integer literals of value 224}
1086 16#F.FF#E+2 2#1.1111_1111_1110#E11 --@RI{ real literals of value 4095.0}
1087 @end{Example}
1088 @end{Examples}
1089
1090 @begin{DiffWord83}
1091 The rule about which letters are allowed is now encoded in BNF,
1092 as suggested by Mike Woodger.
1093 This is clearly more readable.
1094 @end{DiffWord83}
1095
1096 @LabeledClause{Character Literals}
1097
1098 @begin{Intro}
1099 @Redundant[A @nt<character_literal> is formed by enclosing a graphic
1100 character between two apostrophe characters.]
1101 @end{Intro}
1102
1103 @begin{Syntax}
1104 @Syn{lhs=<character_literal>,rhs="@SingleQuote@Synf{graphic_character}@SingleQuote"}
1105 @end{Syntax}@Comment{graphic_character is defined syntactically in Ada 95, but not in Ada 2007}
1106
1107 @begin{Notes}
1108 A @nt{character_literal} is an enumeration literal
1109 of a character type. See @RefSecNum(Character Types).
1110 @end{Notes}
1111
1112 @begin{Examples}
1113 @Leading@keepnext@i{Examples of character literals:}
1114 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00433-01]}
1115 @ChgNote{ Orginal version: @begin{Display}
1116 'A'@ @ @ @ @ '*'@ @ @ @ @ '''@ @ @ @ @ '@ '
1117 @end{Display}}
1118 @begin{Example}
1119 'A' '*' ''' ' '@Chg{Version=[2],New=[
1120 'L' '@Unicode(1051)' '@Unicode(923)' --@RI[ Various els.]
1121 '@Unicode(8734)' '@Unicode(1488)' --@RI[ Big numbers - infinity and aleph.]],Old=[]}
1122 @end{Example}
1123 @end{Examples}
1124
1125 @begin{DiffWord83}
1126 The definitions of the values of literals are in
1127 Sections 3 and 4, rather than here,
1128 since it requires knowledge of types.
1129 @end{DiffWord83}
1130
1131 @LabeledClause{String Literals}
1132
1133 @begin{Intro}
1134 @redundant[A @nt<string_literal> is formed by a sequence of graphic characters
1135 (possibly none) enclosed between two quotation marks used as
1136 string brackets. They are used to represent @nt<operator_symbol>s
1137 (see @RefSecNum(Subprogram Declarations)), values of a string type
1138 (see @RefSecNum(Literals)), and array subaggregates
1139 (see @RefSecNum(Array Aggregates)).
1140 @IndexSee{Term=[quoted string],See=(string_literal)}]
1141 @end{Intro}
1142
1143 @begin{Syntax}
1144 @Syn{lhs=<string_literal>,rhs=<"{@Syn2{string_element}}">}
1145
1146 @Syn{lhs=<string_element>,
1147 rhs=<"" | @SynI{non_quotation_mark_}@Synf{graphic_character}>}
1148
1149 @begin{SyntaxText}
1150 A @nt{string_element} is either a pair of quotation marks (""),
1151 or a single @ntf{graphic_character} other than a quotation mark.
1152 @end{SyntaxText}
1153 @end{Syntax}
1154
1155 @begin{StaticSem}
1156 @Defn2{Term=[sequence of characters], Sec=(of a @nt<string_literal>)}
1157 The @i(sequence of characters) of a @nt<string_literal> is formed
1158 from the sequence of @nt<string_element>s between the bracketing
1159 quotation marks, in the given order,
1160 with a @nt<string_element> that is "" becoming a single quotation
1161 mark in the sequence of characters,
1162 and any other @nt<string_element> being reproduced
1163 in the sequence.
1164
1165 @Defn{null string literal}
1166 A @i(null string literal) is a @nt<string_literal> with no
1167 @nt<string_element>s between the quotation marks.
1168
1169 @end{StaticSem}
1170
1171 @begin{Notes}
1172 An end of line cannot appear in a @nt{string_literal}.
1173
1174 @ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]}
1175 @ChgAdded{Version=[2],Text=[No transformation is performed on the
1176 sequence of characters of a @nt{string_literal}.]}
1177 @end{Notes}
1178
1179 @begin{Examples}
1180 @Leading@keepnext@i{Examples of string literals:}
1181 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00433-01]}
1182 @ChgNote< Original version: @begin{Display}
1183 @tabclear()@tabset(P16)
1184 "Message of the day:"
1185 @comment{Blank line}
1186 "" @\--@i{ a null string literal}
1187 "@ " "A" """" @\--@i{ three string literals of length 1}
1188 @comment{Blank line}
1189 "Characters such as $, %, and } are allowed in string literals"
1190 @end{Display}>
1191 @begin{Example}
1192 "Message of the day:"
1193 @comment{Blank line}
1194 "" --@RI{ a null string literal}
1195 " " "A" """" --@RI{ three string literals of length 1}
1196 @comment{Blank line}
1197 "Characters such as $, %, and } are allowed in string literals"
1198 "Archimedes said ""@unicode(917)@unicode(973)@unicode(961)@unicode(951)@unicode(954)@unicode(945)"""
1199 "Volume of cylinder (@pi@;r@latin1(178)h) = "
1200 @end{Example}
1201 @end{Examples}
1202
1203 @begin{DiffWord83}
1204 The wording has been changed to be strictly lexical.
1205 No mention is made of string or character values, since
1206 @nt<string_literal>s are also used to represent @nt<operator_symbol>s,
1207 which don't have a defined value.
1208
1209 The syntax is described differently.
1210 @end{DiffWord83}
1211
1212 @begin{DiffWord95}
1213 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]}
1214 @ChgAdded{Version=[2],Text=[We explicitly say that the characters of a
1215 @nt{string_literal} should be used as is. In particular, no normalization
1216 or folding should be performed on a @nt{string_literal}.]}
1217 @end{DiffWord95}
1218
1219
1220 @LabeledClause{Comments}
1221
1222 @begin{Intro}
1223 A @nt{comment} starts with two adjacent hyphens and extends up to the end
1224 of the line.
1225 @end{Intro}
1226
1227 @begin{Syntax}
1228 @Syn{lhs=<comment>,
1229 rhs=<--{@SynI{non_end_of_line_}@Synf{character}}>}@Comment{character is defined syntactically in Ada 95,
1230 but not in Ada 2007. We assume the worst here.}
1231
1232 @begin{SyntaxText}
1233 A @nt{comment} may appear on any line of a program.
1234 @end{SyntaxText}
1235 @end{Syntax}
1236
1237 @begin{StaticSem}
1238 The presence or absence of @nt{comment}s has no influence on whether a program
1239 is legal or illegal. Furthermore, @nt{comment}s do not influence the meaning
1240 of a program; their sole purpose is the enlightenment of the human reader.
1241 @end{StaticSem}
1242
1243 @begin{Examples}
1244 @Leading@keepnext@i{Examples of comments:}
1245 @ChgNote{Original version: @begin{Display}
1246 --@i{ the last sentence above echoes the Algol 68 report }
1247 @comment{Blank line}
1248 @key[end]; --@i{ processing of Line is complete }
1249 @comment{Blank line}
1250 --@i{ a long comment may be split onto}
1251 --@i{ two or more consecutive lines }
1252 @comment{Blank line}
1253 ----------------@i{ the first two hyphens start the comment }
1254 @end{Display}}
1255 @begin{Example}
1256 --@RI[ the last sentence above echoes the Algol 68 report ]
1257 @comment{Blank line}
1258 @key[end]; --@RI[ processing of Line is complete ]
1259 @comment{Blank line}
1260 --@RI[ a long comment may be split onto]
1261 --@RI[ two or more consecutive lines ]
1262 @comment{Blank line}
1263 ----------------@RI[ the first two hyphens start the comment ]
1264 @end{Example}
1265 @end{Examples}
1266
1267 @LabeledClause{Pragmas}
1268
1269 @begin{Intro}
1270 @ToGlossaryAlso{Term=<Pragma>,
1271 Text=<A pragma is a compiler directive.
1272 There are language-defined pragmas that give instructions
1273 for optimization, listing control, etc.
1274 An implementation may support additional
1275 (implementation-defined) pragmas.>}
1276 @end{Intro}
1277
1278 @begin{Syntax}
1279 @Syn{lhs=<pragma>,rhs="
1280 @key{pragma} @Syn2{identifier} [(@Syn2{pragma_argument_association} {, @Syn2{pragma_argument_association}})];"}
1281
1282
1283 @Syn{lhs=<pragma_argument_association>,rhs="
1284 [@SynI{pragma_argument_}@Syn2{identifier} =>] @Syn2{name}
1285 | [@SynI{pragma_argument_}@Syn2{identifier} =>] @Syn2{expression}"}
1286
1287 @begin{SyntaxText}
1288 In a @nt<pragma>, any @nt<pragma_argument_association>s without a
1289 @i{pragma_argument_}@nt<identifier> shall precede any
1290 associations with a
1291 @i{pragma_argument_}@nt<identifier>.
1292
1293 @Leading@keepnext@nt{Pragma}s are only allowed at the following places in a program:
1294 @begin{Itemize}
1295 After a semicolon delimiter, but not within a
1296 @nt{formal_part}
1297 or @nt{discriminant_part}.
1298
1299
1300 At any place where the syntax rules allow a construct defined by a
1301 syntactic category whose name ends with "@ntf{declaration}", "@ntf{statement}",
1302 "@ntf{clause}", or "@ntf{alternative}", or one of the syntactic categories
1303 @nt{variant} or @nt{exception_handler};
1304 but not in place of such a construct.
1305 Also at any place where a @nt{compilation_unit} would be allowed.
1306 @end{Itemize}
1307
1308 Additional syntax rules and placement restrictions
1309 exist for specific pragmas.
1310 @end{SyntaxText}
1311 @begin{Discussion}
1312 The above rule is written in text,
1313 rather than in BNF;
1314 the syntactic category @nt{pragma} is not used in any BNF syntax rule.
1315 @end{Discussion}
1316 @begin{Ramification}
1317 A @nt{pragma} is allowed where a
1318 @nt<generic_formal_parameter_declaration> is allowed.
1319 @end{Ramification}
1320 @end{Syntax}
1321
1322 @begin{Intro}
1323 @Defn2{Term=[name], Sec=(of a @nt{pragma})}
1324 @Defn{pragma name}
1325 The @i{name} of a @nt{pragma} is
1326 the identifier following the reserved word @key{pragma}.
1327 @Defn{pragma argument}
1328 @Defn{argument of a pragma}
1329 The @nt{name} or @nt{expression} of a @nt{pragma_argument_association}
1330 is a @i{pragma argument}.
1331
1332 @begin{Honest}
1333 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00284-02]}
1334 @ChgAdded{Version=[2],Text=[For compatibility with Ada 83, the name of a
1335 pragma may also be @lquotes@key{interface}@rquotes@;, which is not an
1336 identifier (because it is a reserved word).
1337 See @RefSecNum{Pragma Interface}.]}
1338 @end{Honest}
1339
1340 @Defn{identifier specific to a pragma}
1341 @Defn{pragma, identifier specific to}
1342 An @i{identifier specific to a pragma} is
1343 an identifier that is used in a pragma argument with special meaning
1344 for that pragma.
1345 @begin{Honest}
1346 Whenever the syntax rules for a given pragma allow
1347 "@nt{identifier}" as an argument of the @nt{pragma},
1348 that @nt{identifier} is an identifier specific to that
1349 pragma.
1350 @end{Honest}
1351 @end{Intro}
1352
1353 @begin{StaticSem}
1354 If an implementation does not recognize the name of a
1355 @nt{pragma}, then it has no effect on the semantics
1356 of the program.
1357 Inside such a @nt{pragma}, the only rules that apply are the
1358 @SyntaxName@;s.
1359 @begin{Honest}
1360 This rule takes precedence over any other rules that imply otherwise.
1361 @end{Honest}
1362 @begin{Ramification}
1363 Note well: this rule applies only to @nt{pragma}s whose name is not
1364 recognized.
1365 If anything else is wrong with a @nt{pragma} (at compile time),
1366 the @nt{pragma} is illegal.
1367 This is true whether the @nt{pragma} is
1368 language defined or implementation defined.
1369
1370 For example, an expression in an unrecognized @nt{pragma} does
1371 not cause freezing, even though the rules in
1372 @RefSec{Freezing Rules} say it does;
1373 the above rule overrules those other rules.
1374 On the other hand, an expression in a recognized @nt{pragma} causes
1375 freezing, even if this makes something illegal.
1376
1377 For another example, an expression that would be ambiguous is not
1378 illegal if it is inside an unrecognized @nt{pragma}.
1379
1380 Note, however, that implementations have to recognize @key[pragma]
1381 Inline(Foo) and freeze things accordingly, even if they choose to never
1382 do inlining.
1383
1384 Obviously, the contradiction needs to be resolved one way or the
1385 other. The reasons for resolving it this way are: The
1386 implementation is simple @em the compiler can just ignore the
1387 @nt{pragma} altogether.
1388 The interpretation of constructs appearing inside
1389 implementation-defined @nt{pragma}s is implementation defined. For
1390 example: @lquotes@;@key[pragma] Mumble(X);@rquotes@;. If the current implementation has
1391 never heard of Mumble, then it doesn't know whether X is a name,
1392 an expression, or an identifier specific to the pragma Mumble.
1393 @end{Ramification}
1394 @begin{Honest}
1395 The syntax of individual pragmas overrides the general
1396 syntax for @nt{pragma}.
1397 @end{Honest}
1398 @begin{Ramification}
1399 Thus, an identifier specific to a pragma is not a @nt{name},
1400 syntactically; if it were, the visibility rules would be invoked,
1401 which is not what we want.
1402
1403 This also implies that named associations do not allow one to give the
1404 arguments in an arbitrary order @em the order given in the syntax rule
1405 for each individual pragma must be obeyed.
1406 However, it is generally possible to leave out earlier arguments when
1407 later ones are given; for example, this is allowed by the syntax rule
1408 for pragma Import (see @RefSec{Interfacing Pragmas}).
1409 As for subprogram calls, positional notation precedes named
1410 notation.
1411
1412 Note that Ada 83 had no pragmas for which the order of named
1413 associations mattered, since there was never more than one argument
1414 that allowed named associations.
1415 @end{Ramification}
1416 @begin{Honest}
1417 The interpretation of the arguments of implementation-defined pragmas
1418 is implementation defined.
1419 However, the syntax rules have to be obeyed.
1420 @end{Honest}
1421 @end{StaticSem}
1422
1423 @begin{RunTime}
1424 @PDefn2{Term=[execution], Sec=(pragma)}
1425 @PDefn2{Term=[elaboration], Sec=(pragma)}
1426 Any @nt{pragma} that appears at the place of an executable construct is
1427 executed.
1428 Unless otherwise specified for a particular pragma,
1429 this execution consists of the evaluation of each evaluable pragma
1430 argument in an arbitrary order.
1431 @begin{Ramification}
1432 For a @nt{pragma} that appears at the place of an elaborable
1433 construct, execution is elaboration.
1434
1435 An identifier specific to a pragma is neither a @nt{name} nor an
1436 @nt{expression} @em such identifiers are not evaluated (unless an
1437 implementation defines them to be evaluated in the case of an
1438 implementation-defined @nt{pragma}).
1439
1440 The @lquotes@;unless otherwise specified@rquotes@; part allows us (and
1441 implementations) to make exceptions, so a @nt{pragma} can contain an
1442 expression that is not evaluated.
1443 Note that @nt{pragma}s in @nt{type_definition}s may contain expressions
1444 that depend on discriminants.
1445
1446 When we wish to define a pragma with some run-time effect,
1447 we usually make sure that it appears in an executable context;
1448 otherwise, special rules are needed to define the run-time effect
1449 and when it happens.
1450 @end{Ramification}
1451 @end{RunTime}
1452
1453 @begin{ImplReq}
1454 The implementation shall give a warning message for
1455 an unrecognized pragma name.
1456 @begin{Ramification}
1457 An implementation is also allowed to have modes in which a warning
1458 message is suppressed, or in which the presence of an unrecognized
1459 @nt{pragma} is a compile-time error.
1460 @end{Ramification}
1461 @end{ImplReq}
1462
1463 @begin{ImplPerm}
1464 An implementation may provide implementation-defined pragmas;
1465 the name of an implementation-defined pragma shall differ
1466 from those of the language-defined pragmas.
1467 @ImplDef{Implementation-defined pragmas.}
1468 @begin{Ramification}
1469 The semantics of implementation-defined pragmas, and any associated
1470 rules (such as restrictions on their placement or arguments),
1471 are, of course, implementation defined.
1472 Implementation-defined pragmas may have run-time effects.
1473 @end{Ramification}
1474
1475 An implementation may ignore an unrecognized pragma even if
1476 it violates some of the @SyntaxName@;s, if detecting the
1477 syntax error is too complex.
1478 @begin{Reason}
1479 Many compilers use extra post-parsing checks to enforce the syntax
1480 rules, since the Ada syntax rules are not LR(k) (for any k).
1481 (The grammar is ambiguous, in fact.)
1482 This paragraph allows them to ignore an unrecognized pragma, without
1483 having to perform such post-parsing checks.
1484 @end{Reason}
1485 @end{ImplPerm}
1486
1487 @begin{ImplAdvice}
1488 Normally,
1489 implementation-defined pragmas should have no semantic effect
1490 for error-free programs;
1491 that is, if the implementation-defined pragmas are removed from a
1492 working program,
1493 the program should still be legal, and should still have the same
1494 semantics.
1495 @ChgImplAdvice{Version=[2],Kind=[Added],Text=[@ChgAdded{Version=[2],
1496 Text=[Implementation-defined pragmas should have no semantic effect
1497 for error-free programs.]}]}
1498 @begin{Ramification}
1499 Note that @lquotes@;semantics@rquotes@; is not the same as @lquotes@;effect;@rquotes@;
1500 as explained in
1501 @RefSecNum{Conformity of an Implementation With the Standard},
1502 the semantics defines a set of possible effects.
1503
1504 Note that adding a @nt{pragma} to a program might cause an error
1505 (either at compile time or at run time).
1506 On the other hand, if the language-specified semantics for a
1507 feature are in part implementation defined,
1508 it makes sense to support pragmas that control the feature,
1509 and that have real semantics; thus,
1510 this paragraph is merely a recommendation.
1511 @end{Ramification}
1512
1513 @Leading@;Normally,
1514 an implementation should not define pragmas that can make an illegal
1515 program legal, except as follows:
1516 @begin(Itemize)
1517 A @nt<pragma> used to complete a declaration, such as a @nt{pragma} Import;
1518
1519 A @nt<pragma> used to configure the environment
1520 by adding, removing, or replacing @nt{library_item}s.
1521 @end(Itemize)
1522 @ChgImplAdvice{Version=[2],Kind=[Added],Text=[@ChgAdded{Version=[2],
1523 Text=[Implementation-defined pragmas should not make an illegal program
1524 legal, unless they complete a declaration or configure the @nt{library_item}s
1525 in an environment.]}]}
1526 @begin(Ramification)
1527 For example, it is OK to support Interface,
1528 System_Name, Storage_Unit, and Memory_Size @nt{pragma}s
1529 for upward compatibility reasons,
1530 even though all of these @nt{pragma}s can make an illegal program legal.
1531 (The latter three can affect legality in a rather subtle way:
1532 They affect the value of named numbers in System,
1533 and can therefore affect the legality in cases where
1534 static expressions are required.)
1535
1536 On the other hand,
1537 adding implementation-defined pragmas to a legal program can make it illegal.
1538 For example, a common kind of implementation-defined pragma is one that
1539 promises some property that allows more efficient code to be generated.
1540 If the promise is a lie,
1541 it is best if the user gets an error message.
1542 @end(Ramification)
1543 @end{ImplAdvice}
1544
1545 @begin{Incompatible83}
1546 @Defn{incompatibilities with Ada 83}
1547 In Ada 83, @lquotes@;bad@rquotes@; @nt{pragma}s are ignored.
1548 In Ada 95, they are illegal,
1549 except in the case where the name of the @nt{pragma} itself
1550 is not recognized by the implementation.
1551 @end{Incompatible83}
1552
1553 @begin{Extend83}
1554 @Defn{extensions to Ada 83}
1555 Implementation-defined @nt{pragma}s may affect the legality of a program.
1556 @end{Extend83}
1557
1558 @begin{DiffWord83}
1559 Implementation-defined @nt{pragma}s may affect the run-time semantics of
1560 the program.
1561 This was always true in Ada 83 (since it was not explicitly forbidden by
1562 RM83), but it was not clear, because there was no definition of
1563 @lquotes@;executing@rquotes@; or @lquotes@;elaborating@rquotes@; a @nt{pragma}.
1564 @end{DiffWord83}
1565
1566 @begin{Syntax}
1567 @Leading@keepnext@;The forms of List, Page, and Optimize @nt{pragma}s are as follows:
1568
1569 @PragmaSyn`@key{pragma} @prag(List)(@Syn2{identifier});'
1570
1571 @PragmaSyn`@key{pragma} @prag(Page);'
1572
1573 @PragmaSyn`@key{pragma} @prag(Optimize)(@Syn2{identifier});'
1574
1575 @begin{SyntaxText}
1576 @Redundant[Other pragmas are defined throughout this International Standard,
1577 and are summarized in
1578 @RefSecNum{Language-Defined Pragmas}.]
1579 @begin{Ramification}
1580 The language-defined pragmas
1581 are supported by every implementation,
1582 although @lquotes@;supporting@rquotes@; some of
1583 them (for example, Inline) requires nothing more than checking the
1584 arguments, since they act only as advice to the implementation.
1585 @end{Ramification}
1586
1587 @end{SyntaxText}
1588 @end{Syntax}
1589
1590 @begin{StaticSem}
1591 A @nt{pragma} List
1592 takes one of the @nt{identifier}s On or Off as the single
1593 argument. This pragma is allowed anywhere a
1594 @nt{pragma} is allowed. It specifies that listing of the
1595 compilation is to be continued or suspended until a List
1596 @nt{pragma} with the opposite argument is given within the
1597 same compilation. The @nt{pragma} itself is always listed if
1598 the compiler is producing a listing.
1599
1600 A @nt{pragma} Page
1601 is allowed anywhere a
1602 @nt{pragma} is allowed. It specifies that the program text
1603 which follows the @nt{pragma} should start on a new page (if
1604 the compiler is currently producing a listing).
1605
1606 A @nt{pragma} Optimize
1607 takes one of the @nt{identifier}s Time, Space, or Off as the
1608 single argument. This @nt{pragma} is allowed anywhere a @nt<pragma>
1609 is allowed, and it applies until the end of the immediately enclosing
1610 declarative region,
1611 or for a @nt{pragma} at the place of a @nt{compilation_unit},
1612 to the end of the @nt<compilation>.
1613 It gives advice to the implementation as to
1614 whether time or space is the primary optimization criterion, or
1615 that optional optimizations should be turned off.
1616 @Redundant[It is implementation defined how this advice is followed.]
1617 @ImplDef{Effect of pragma Optimize.}
1618 @begin{Discussion}
1619
1620 For example, a compiler might use Time vs. Space to control whether
1621 generic instantiations are implemented with a macro-expansion model,
1622 versus a shared-generic-body model.
1623
1624
1625 We don't define what constitutes an @lquotes@;optimization@rquotes@;
1626 @em in fact, it cannot be formally defined in the context of Ada.
1627 One compiler might call something an optional optimization,
1628 whereas another compiler might consider that same thing
1629 to be a normal part of code generation.
1630 Thus, the programmer cannot rely on this pragma having any
1631 particular portable effect on the generated code.
1632 Some compilers might even ignore the pragma altogether.
1633 @end{Discussion}
1634 @end{StaticSem}
1635
1636 @begin{Examples}
1637 @Leading@keepnext@i{Examples of pragmas:}
1638 @begin{Example}
1639 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00433-01]}
1640 @key[pragma] List(Off); --@RI{ turn off listing generation}
1641 @key[pragma] Optimize(Off); --@RI{ turn off optional optimizations}
1642 @key[pragma] Inline(Set_Mask); --@RI{ generate code for Set_Mask inline}
1643 @Chg{Version=[2],New=[@key[pragma] Import(C, Put_Char, External_Name => "putchar"); --@RI{ import C putchar function}],
1644 Old=[@key[pragma] Suppress(Range_Check, On => Index); --@RI{ turn off range checking on Index}]}
1645 @end{Example}
1646 @end{Examples}
1647
1648 @begin{Extend83}
1649 @Defn{extensions to Ada 83}
1650 The Optimize @nt<pragma> now allows the identifier Off
1651 to request that normal optimization be turned off.
1652
1653 An Optimize @nt<pragma> may appear anywhere pragmas are allowed.
1654 @end{Extend83}
1655
1656 @begin{DiffWord83}
1657 We now describe the pragmas Page, List, and Optimize here,
1658 to act as examples, and to remove the normative material from
1659 @RefSec{Language-Defined Pragmas}, so it can be entirely an
1660 informative annex.
1661 @end{DiffWord83}
1662
1663 @begin{DiffWord95}
1664 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00433-01]}
1665 @ChgAdded{Version=[2],Text=[Updated the example of named pragma parameters,
1666 because the second parameter of @nt{pragma} Suppress is obsolescent.]}
1667 @end{DiffWord95}
1668
1669
1670 @LabeledClause{Reserved Words}
1671
1672 @begin{Syntax}
1673 @begin{Bundle}
1674 @ChgRef{Version=[1], Kind=[Deleted]}
1675 @ChgDeleted[Version=[1],Type=[Leading],Text=<@ @;@comment{Empty paragraph to hang junk paragraph number from original RM}>]
1676
1677 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00284-02],ARef=[AI95-00395-01]}
1678 @ChgNote{The table of words has no paragraph number, so we need to put the
1679 change here}
1680 @Leading
1681 @Defn{reserved word}
1682 The following are the @i{reserved words}@Chg{Version=[2],New=[. Within a program,
1683 some or all of the letters of a reserved word may be in upper case, and one or
1684 more characters in category @ntf{other_format} may be inserted within or at the
1685 end of the reserved word.],Old=[ (ignoring upper/lower case distinctions):]}
1686 @begin{Discussion}
1687 Reserved words have special meaning in the syntax.
1688 In addition, certain reserved words are used as attribute names.
1689
1690 The syntactic category @nt{identifier}
1691 no longer allows reserved words. We have added the few reserved
1692 words that are legal explicitly to the syntax for @nt{attribute_reference}.
1693 Allowing identifier to include reserved words has been a source
1694 of confusion for some users, and differs from the way they
1695 are treated in the C and Pascal language definitions.
1696 @end{Discussion}
1697 @*
1698
1699 @begin{Display}
1700 @begin{FourCol}
1701 @noparanum@key{abort}
1702 @key{abs}
1703 @key{abstract}
1704 @key{accept}
1705 @key{access}
1706 @key{aliased}
1707 @key{all}
1708 @key{and}
1709 @key{array}
1710 @key{at}
1711
1712 @noparanum@key{begin}
1713 @key{body}
1714
1715 @noparanum@key{case}
1716 @key{constant}
1717
1718 @noparanum@key{declare}
1719 @key{delay}
1720 @key{delta}
1721 @key{digits}
1722 @key{do}
1723 @NewColumn
1724
1725 @noparanum@key{else}
1726 @key{elsif}
1727 @key{end}
1728 @key{entry}
1729 @key{exception}
1730 @key{exit}
1731
1732 @noparanum@key{for}
1733 @key{function}
1734
1735 @noparanum@key{generic}
1736 @key{goto}
1737
1738 @noparanum@key{if}
1739 @key{in}
1740 @Chg{Version=[2],New=[@key{interface}],Old=[]}
1741 @key{is}
1742
1743
1744 @noparanum@key{limited}
1745 @key{loop}
1746
1747 @noparanum@key{mod}
1748 @NewColumn
1749
1750 @noparanum@key{new}
1751 @key{not}
1752 @key{null}
1753
1754
1755 @noparanum@key{of}
1756 @key{or}
1757 @key{others}
1758 @key{out}
1759 @Chg{Version=[2],New=[@key{overriding}],Old=[]}
1760
1761 @noparanum@key{package}
1762 @key{pragma}
1763 @key{private}
1764 @key{procedure}
1765 @key{protected}
1766
1767 @noparanum@key{raise}
1768 @key{range}
1769 @key{record}
1770 @key{rem}
1771 @key{renames}
1772 @key{requeue}
1773 @NewColumn
1774
1775 @noparanum@key{return}
1776 @key{reverse}
1777
1778 @noparanum@key{select}
1779 @key{separate}
1780 @key{subtype}
1781 @Chg{Version=[2],New=[@key{synchronized}],Old=[]}
1782
1783 @noparanum@key{tagged}
1784 @key{task}
1785 @key{terminate}
1786 @key{then}
1787 @key{type}
1788
1789 @noparanum@key{until}
1790 @key{use}
1791
1792 @noparanum@key{when}
1793 @key{while}
1794 @key{with}
1795
1796 @noparanum@key{xor}
1797 @end{FourCol}
1798 @end{Display}
1799 @end{Bundle}
1800 @end{Syntax}
1801
1802 @begin{Notes}
1803 The reserved words appear in @key{lower case boldface}
1804 in this International Standard,
1805 except when used in the @nt{designator} of an attribute
1806 (see @RefSecNum(Attributes)).
1807 Lower case boldface is also used
1808 for a reserved word in a
1809 @nt{string_literal} used as an @nt{operator_symbol}.
1810 This is merely a convention @em programs may be written in whatever
1811 typeface is desired and available.
1812 @end{Notes}
1813
1814 @begin{Incompatible83}
1815 @Defn{incompatibilities with Ada 83}
1816 The following words are not reserved in Ada 83, but are reserved in Ada
1817 95: @key{abstract}, @key{aliased}, @key{protected}, @key{requeue},
1818 @key{tagged}, @key{until}.
1819 @end{Incompatible83}
1820
1821 @begin{DiffWord83}
1822 The clause entitled @lquotes@;Allowed Replacements of Characters@rquotes@; has been moved
1823 to @RefSec(Obsolescent Features).
1824 @end{DiffWord83}
1825
1826 @begin{Incompatible95}
1827 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00284-02]}
1828 @ChgAdded{Version=[2],Text=[@Defn{incompatibilities with Ada 95}
1829 The following words are not reserved in Ada 95, but are reserved in Ada
1830 2005: @key{interface}, @key{overriding}, @key{synchronized}. A special
1831 allowance is made for @key{pragma} Interface (see @RefSecNum{Pragma Interface}).
1832 Uses of these words as identifiers will need to be changed, but we do not
1833 expect them to be common.]}
1834 @end{Incompatible95}
1835
1836 @begin{DiffWord95}
1837 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00395-01]}
1838 @ChgAdded{Version=[2],Text=[The definition of upper case equivalence has
1839 been modified to allow identifiers using all of the characters of ISO 10646.
1840 This change has no effect on the character sequences that are reserved
1841 words, but does make some unusual sequences of characters illegal.]}
1842 @end{DiffWord95}