3 Lexical conventions


Overview

The lexical conventions describe the allowable character sequences that are used to create identifiers, numbers and the special values used in the language. Implementations must support 200 characters lexical elements at the least.


Identifiers

Can be of any length (but can be restricted by an implementation).

Can only contain characters, digits and underscores

Must start with a character

Are case insensitive

E.g.


Literals

Literals are the typed representation of the values stored in the program.

Numeric literals can be broken up with non consecutive underscores as desired.

E.g. 5_101_456 is the number 5101456
3.147_252_6

Numeric literals cannot end or start with an underscore.

Exponential notation is available for floats and integers

E.g. 2E6, 9E+4

Numeric literals can be represented in different bases (2-16).

E.g. 2#1011#, 10#45#, 16#Fe23#, 2#11100.11001#

Float literals must have a digit either side of the radix point

E.g. 3.14, 100.0

Thus the numbers 100. or .034 are not valid float numbers.

Character literals are surrounded by single quotes

E.g. 'a', 'b'

String literals are surrounded by double quotes

E.g. "Ada", "literal", "embedded ""strings""!"

String literals cannot contain the tab character. String values can contain them, this can be achieved by either concatenating strings and characters together, or directly inserting the character into the string.


Comments

Comments are introduced by the -- symbol and extend to the end of the line.


Reserved Words

Reserved words followed by an asterisk have been introduced in Ada95.


to the index...