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.
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
Apple, apple, APPLE -- same identifier Max_Velocity_Attained Minor_Number_ -- illegal, trailing underscore Minor__Revision -- illegal, consecutive underscores
Literals are the typed representation of the values stored in the
Numeric literals can be broken up with non consecutive underscores as desired.
E.g. 5_101_456 is the number 5101456
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 are introduced by the -- symbol and extend to the end of the line.
abort else new return
abs elsif not reverse
abstract* end null
accept entry select
access exception separate
aliased* exit of subtype
and for others tagged*
array function out task
generic package then
begin goto pragma type
case in protected* until*
constant is use
declare range when
delay limited record while
delta loop record while
do mod requeue* xor
Reserved words followed by an asterisk have been introduced in Ada95.