The following syntax rules are taken from Annex P of the ARM. The rules have been reordered to correspond to the order of introduction of the topics in this book but individual rules have not been changed.
It should be noted that the rules for the construction of lexical elements, which are under the subheading of Chapter 5, have a slightly different status from the other rules since spaces and newlines may be freely inserted between lexical elements but not within lexical elements.
The rules have been sequentially numbered for ease of reference; an index to them will be found in Section A3.2. Note that in rules 74 (discrete_choice_list), 98 (component_choice_list), 111 (membership choice_list), 201 (exception_handler), and 226 (discriminant_association), the vertical bar following the brace stands for itself and is not a metasymbol.
Syntax rules
Chapter 5
1 identifier ::= identifier_start ﹛identifier_start | identifier_extend﹜
2 identifier_start ::= letter_uppercase | letter_lowercase | letter_titlecase | letter_modifier | letter_other | number_letter
3 identifier_extend ::= mark_nonspacing | mark_spacing_combining | number_decimal | punctuation_connector
4 numeric_literal ::= decimal_literal | based_literal
5 decimal_literal ::= numeral [. numeral] [exponent]
6 numeral ::= digit ﹛[underline] digit﹜
7 exponent ::= E [+] numeral | E - numeral
8 digit ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
9 based_literal ::= base # based_numeral [. based_numeral] # [exponent]
10 base ::= numeral
11 based_numeral ::= extended_digit ﹛[underline] extended_digit﹜
12 extended_digit ::= digit | A | B | C | D | E | F
13 character_literal ::= ‘graphic_character'
14 string_literal ::= “﹛string_element﹜“
15 string_element ::= “” | non_quotation_mark_graphic_character
16 comment ::= -- ﹛non_end_of_line_character﹜
17 pragma ::= pragma identifier [(pragma_argument_association ﹛, pragma_argument_association﹜)];
18 pragma_argument_association ::=
| [pragma_argument_identifier =>] name
| [pragma_argument_identifier =>] expression
| pragma_argument_aspect_mark => name
| pragma_argument_aspect_mark => expression
Chapter 6
19 basic_declaration ::=
type_declaration | subtype_declaration
| object_declaration | number_declaration
| subprogram_declaration | abstract_subprogram_declaration
| null_procedure_declaration | expression_function_declaration
| package_declaration | renaming_declaration
| exception_declaration | generic_declaration
| generic_instantiation
20 object_declaration ::=
| defining_identifier_list : [aliased] [constant] subtype_indication [:= expression] [aspect_specification];
| defining_identifier_list : [aliased] [constant] access_definition [:= expression] [aspect_specification];
| defining_identifier_list : [aliased] [constant] array_type_definition [:= expression] [aspect_specification];
| single_task_declaration
| single_protected_declaration
21 number_declaration ::=
defining_identifier_list : constant := static_expression;
22 defining_identifier_list ::= defining_identifier ﹛, defining_identifier﹜
23 defining_identifier ::= identifier
24 assignment_statement ::= variable_name := expression;
To save this book to your Kindle, first ensure [email protected] is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.
Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.
Find out more about the Kindle Personal Document Service.
To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.
To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.