denotation ::= integer_number | floating_number | Boolean_value |
character_constant | string_constant |
bit_constant | 'void' .
integer_number ::= digit\plus ( '_' digit\plus )\stern .
floating_number ::= integer_number [ '.' integer_number] scaling |
integer_number '.' integer_number | 'NaN' | 'Inf' .
scaling ::= ('E' | 'e') ['+' | '-' ] integer_number .
Boolean_value ::= 'true' | 'false' .
character_constant ::= '\,'\,'\, character\, '\,'\,' .
character ::= \hbox{\it all printable characters except $\backslash\,$, ' and {\tt "}} |
'$\backslash\backslash$' | '$\backslash$'\,' | '$\backslash$"' | '$\backslash$e' | '$\backslash$b' | '$\backslash$t' | '$\backslash$n' | '$\backslash$v' | '$\backslash$f' | '$\backslash$r' |
'$\backslash$' octal_digit octal_digit octal_digit |
'$\backslash$' [ 'x' | 'X' ] sedecimal_digit sedecimal_digit .
string_constant ::= '"'\, character\stern\, '"' ('"'\, character\stern\, '"')
\stern .
bit_constant ::= octal_number | sedecimal_number .
octal_number ::= '0' ( 'o' | 'O' ) octal_digit\plus ( '_' octal_digit\plus )\stern .
octal_digit ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' .
sedecimal_number::= '0' ( 'x' | 'X' ) sedecimal_digit\plus ( '_' sedecimal_digit\plus )\stern .
sedecimal_digit ::= digit |
'a' | 'b' | 'c' | 'd' |'e' |'f' |
'A' | 'B'| 'C' | 'D' | 'E' | 'F' .
A '_' occurring in a number is ignored.
Integer and floating-point numbers have the usual meaning. They are of type UNIVERSAL_INT and UNIVERSAL_REAL respectively which are of finite but unbounded size and precision. These types can only be used for computing expressions which are constant at compile-time. Otherwise values of these types are coerced to the appropriate numeric type depending on context, cf. 7.2. The values NaN (Not a Number) and Inf have the meaning as defined in IEEE Standard 754-1985 (Binary Floating Point Arithmetic). NaN denotes an arbitrary signalling NaN; note that, according to the standard, the comparison NaN = NaN always yields false.
Character constants denote values of type CHAR consisting of one
character only. As in the language C the character
assigns to the subsequent character
, ' or "
its original meaning.
followed by one of the
characters a, b, t, n, v, f or r has the
meaning of the control characters bell (or alert) (0x07),
backspace (0x08), tab (0x09), line feed (0x0A),
vertical tab (0x0B), form feed (0x0C), and carriage return
(0x0D) respectively. '
' followed by three octal digits or
by x and 2 sedecimal digits denotes the character whose integer
encoding is given by the octal or sedecimal number.
String constants denote values of type STR which are sequences of characters. Empty strings and strings consisting of one character only are permitted.
Hint: Strings are implemented following the C conventions: a string in
memory is terminated by the first occurrence of the NUL
character. Hence a string of length n requires at least n+1
bytes of storage. Sorry we know that this is dull but we cannot
change the system conventions.
Hint: Implementations may choose to provide multibyte characters. Hence
programs cannot assume that a character is always encoded by one
byte.
Bit constants are written as octal or sedecimal numbers and represent values of type UNIVERSAL_BITS. Values of this type are coerced to the appropriate type depending on context, cf. 7.2.
Note: Universal types free the programmer from the burden to change
the notation of constants when switching between different
representations of integers or reals. Bit constants can be used for
a variety of purposes; in some cases, e.g., when representing characters
or strings in binary form, the meaning of bit constants is
implementation dependent.
The constant void denotes the empty reference and simultaneously belongs to all stream object and reference types.