2.3 Identifiers
This Reference Manual output has not been verified, and may contain omissions or errors. Report any problems on the tracking issue
Identifier
s are used as names.
Syntax
2/2identifier
::=
identifier_start
{identifier_start
| identifier_extend
}
3/2identifier_start
::=
letter_uppercase
| letter_lowercase
| letter_titlecase
| letter_modifier
| letter_other
| number_letter
3.1/3identifier_extend
::=
mark_non_spacing
| mark_spacing_combining
| number_decimal
| punctuation_connector
4/3An identifier
shall not contain two consecutive characters in category punctuation_connector
, or end with a character in that category.
Legality Rules
4.1/5An identifier shall only contain characters that may be present in Normalization Form KC (as defined by Clause 21 of ISO/IEC 10646:2017).
Static Semantics
5/5Two identifier
s are considered the same if they consist of the same sequence of characters after applying locale-independent simple case folding, as defined by documents referenced in Clause 2 of ISO/IEC 10646:2017 .
After applying simple case folding, an identifier
shall not be identical to a reserved word.
identifier
s and reserved words are the same. Since a compiler usually will lexically process identifier
s and reserved words the same way (often with the same code), this will prevent a lot of headaches. identifier
s nor reserved words. We are not aware of any such sequences so long as we use simple case folding (as opposed to full case folding), but we have defined the rules in case any are introduced in future character set standards. This originally was a problem when converting to upper case: “ıf” and “acceß” have upper case conversions of “IF” and “ACCESS” respectively. We would not want these to be treated as reserved words. But neither of these cases exist when using simple case folding. Implementation Permissions
6In a nonstandard mode, an implementation may support other upper/lower case equivalence rules for identifier
s[, to accommodate local conventions].
DİYARBAKIR -- The first i is dotted, the second isn't.
diyarbakır
dİyarbakir
diyarbakir
diyarbakır
dıyarbakir
dıyarbakır
Identifier
s differing only in the use of corresponding upper and lower case letters are considered the same. Examples
7Examples of identifiers:
Count X Get_Symbol Ethelyn Marion
Snobol_4 X1 Page_Count Store_Next_Item
Πλάτων -- Plato
Чайковский -- Tchaikovsky
θ φ -- Angles
Wording Changes from Ada 83
identifier
s. This is not a language change. In Ada 83, identifier
included reserved words. However, this complicated several other rules (for example, regarding implementation-defined attributes and pragmas, etc.). We now explicitly allow certain reserved words for attribute designators, to make up for the loss. identifier
. As a side effect, implementations cannot use reserved words as implementation-defined attributes or pragma names. Extensions to Ada 95
identifier
can use any letter defined by ISO-10646:2003, along with several other categories. This should ease programming in languages other than English. Incompatibilities With Ada 2005
other_format
characters were removed from identifiers as the Unicode recommendations have changed. This change can only affect programs written for the original Ada 2005, so there should be few such programs.