Summary
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;
- Type
- Chapter
- Information
- Programming in Ada 2012 , pp. 873 - 900Publisher: Cambridge University PressPrint publication year: 2014
- 1
- Cited by