LANGUAGE "Ada95" -------------- LEXICON ------- -- Ada lexical grammar created by Steven Haden on 20-FEB-1987 -- Add the allowable replacement of characters (for '|', '"' and '#') C.G. DEFINITIONS ----------- SETS letter = <'A'..'Z', 'a'..'z'>. digit = <'0'..'9'>. extended_digit = . EXPRESSIONS integer = digit { ['_'-] digit }. exponent = <'E', 'e'> [<'+', '-'>] integer. based_integer = extended_digit { ['_'-] extended_digit }. SEPARATORS ---------- CHARACTERS <' ', ht, vt, ff, eol, nul>. COMMENTS FROM "--" TO eol. TOKENS ------- IDENTIFIER:CASELESS = letter { ['_'] }. NUMERIC_LITERAL:CASELESS = integer ['.' integer] [exponent] | integer '#' based_integer ['.' based_integer] '#' [exponent] | integer ':' based_integer ['.' based_integer] ':' [exponent]. STRING_LITERAL = '"'- { ^ | '"'- '"' } '"'- | '%'- { ^ | '%'- '%' } '%'-. CHARACTER_LITERAL = '''- printable '''- . VERTICAL_BAR = '|' | '!'. "&". "'". "(". ")". "*". "+". ",". "-". ".". "/". ":". ";". "<". "=". ">". "=>". "..". "**". ":=". "/=". ">=". "<=". "<<". ">>". "<>". INSTANCES --------- -- The reserved words IDENTIFIER => (ABORT ABS ABSTRACT ACCEPT ACCESS ALIASED ALL AND ARRAY AT BEGIN BODY CASE CONSTANT DECLARE DELAY DELTA DIGITS DO ELSE ELSIF END ENTRY EXCEPTION EXIT FOR FUNCTION GENERIC GOTO IF IN IS LIMITED LOOP MOD NEW NOT NULL OF OR OTHERS OUT PACKAGE PRAGMA PRIVATE PROCEDURE PROTECTED RAISE RANGE RECORD REM RENAMES REQUEUE RETURN REVERSE SELECT SEPARATE SUBTYPE TAGGED TASK TERMINATE THEN TYPE UNTIL USE WHEN WHILE WITH XOR). AMBIGUITIES ----------- "'" WHEN_PRECEDED_BY IDENTIFIER . -- Tells the parser to recognize the symbol "'" and not the beginning -- of CHARACTER_LITERAL in a qualified expression like T'('a', B). SYNTAX ------ -- Revision 6 : 2-FEV-1989 C. Genillard : Unification of name and function_call -- as they are ambiguous in many cases. A new terminal -- name_or_function_call is introduced at places where name or -- function_call were used. At some places, name was too general -- and has been replaced by [expanded_name_start] IDENTIFIER. -- An other new terminal general_association is introduced to -- represent either parameters association or index of component. -- Revision 5 : 29-JAN-1989 C. Genillard : Small modifications in expression, -- simple_expression and component_associations. -- Revision 4 : 15-NOV-1988 C. Genillard : Correct a bug in expression: -- repetion of relational operator is possible. -- Revision 3 : 10-SEP-1987 C. Genillard : Corrected to be non left-recursive -- The following non-terminals where corrected : -- indexed_component, slice, selected_component and attribute -- and the following where added : -- name_start, name_remainder, indexed_component_or_slice, -- indexed_component_or_slice_remainder, -- selected_component_remainder and attribute_remainder. -- Revision 2 : 04-SEP-1987 C. Genillard, different ameliorations : -- suppress some ambiguities and try to clarify, simplify or -- precise some definitions... -- Revision 1 : 04-SEP-1987 C. Genillard, add pragmas_opt and place it as -- defined by LRM (2.8) and add the three reserved words -- DELTA, DIGITS and RANGE as attribute designator. -- ADA syntactic grammar created by N. H. LAM in november 1985 AXIOMS ------ compilation. RULES ----- -- 2.8 pragma = "PRAGMA" IDENTIFIER [ "(" {+ pragma_argument_association $ "," +} ")" ] ";". pragma_argument_association = [ IDENTIFIER "=>" ] ( expression ). pragmas_opt = { pragma }. -- 3.1 basic_declaration = type_declaration | object_declaration | subprogram_declaration | package_declaration | exception_declaration | generic_instantiation | subtype_declaration | number_declaration | abstract_subprogram_declaration | renaming_declaration | generic_declaration. defining_identifier = IDENTIFIER. -- 3.2.1 -> 3.3.1 type_declaration = full_type_declaration | incomplete_type_declaration | private_type_declaration | private_extension_declaration. full_type_declaration = "TYPE" defining_identifier [ known_discriminant_part ] "IS" type_definition ";" | task_type_declaration | protected_type_declaration. type_definition = enumeration_type_definition | integer_type_definition | real_type_definition | array_type_definition | record_type_definition | access_type_definition | derived_type_definition. -- 3.2.2 -> 3.3.2 subtype_declaration = "SUBTYPE" defining_identifier "IS" subtype_indication ";". subtype_indication = subtype_mark [ constraint ]. subtype_indication_b = constraint. subtype_mark = name. constraint = scalar_constraint | composite_constraint. scalar_constraint = range_constraint | digits_constraint | delta_constraint. composite_constraint = index_constraint | discriminant_constraint. -- 3.3.1 -> 3.2 object_declaration = defining_identifier_list ":" ["ALIASED"]["CONSTANT"] ( subtype_indication | array_type_definition ) [ ":=" expression ] ";" | single_task_declaration | single_protected_declaration. defining_identifier_list = {+ defining_identifier $ "," +}. -- 3.3.2 number_declaration = defining_identifier_list ":" "CONSTANT" ":=" expression ";". -- 3.4 derived_type_definition = ["ABSTRACT"] "NEW" subtype_indication [ record_extension_part ]. -- 3.5 range_constraint = "RANGE" range. range = range_attribute_reference | simple_expression ".." simple_expression. -- 3.5.1 enumeration_type_definition = "(" {+ enumeration_literal_specification $ "," +} ")". enumeration_literal_specification = defining_identifier | defining_character_literal. defining_character_literal = CHARACTER_LITERAL. -- 3.5.4 integer_type_definition = signed_integer_type_definition | modular_type_definition. signed_integer_type_definition = "RANGE" simple_expression ".." simple_expression. modular_type_definition = "MOD" expression. -- 3.5.6 real_type_definition = floating_point_definition | fixed_point_definition. -- 3.5.7 floating_point_definition = "DIGITS" expression [ real_range_specification ]. real_range_specification = "RANGE" simple_expression ".." simple_expression. -- 3.5.9 fixed_point_definition = ordinary_fixed_point_definition | decimal_fixed_point_definition. ordinary_fixed_point_definition = "DELTA" expression real_range_specification. decimal_fixed_point_definition = "DELTA" expression "DIGITS" expression [ real_range_specification ]. digits_constraint = "DIGITS" expression [ range_constraint ]. -- 3.6 array_type_definition = unconstrained_array_definition | constrained_array_definition. unconstrained_array_definition = "ARRAY" "(" {+ index_subtype_definition $ "," +} ")" "OF" component_definition. index_subtype_definition = subtype_mark "RANGE" "<>". constrained_array_definition = "ARRAY" "(" {+ discrete_subtype_definition $ "," +} ")" "OF" component_definition. discrete_subtype_definition = subtype_indication | range. component_definition = [ "ALIASED" ] subtype_indication. -- 3.6.1 index_constraint = "(" {+ discrete_range $ "," +} ")". -- discrete_range = subtype_indication | range. -- discrete_range = name [ subtype_indication_b ] -- | name range_attribute_reference_b -- | simple_expression ".." simple_expression. discrete_range = name ( [ subtype_indication_b ] | range_attribute_reference_b ) | simple_expression ".." simple_expression. discriminant_part = unknown_discriminant_part | known_discriminant_part. -- 3.7 unknown_discriminant_part = "(" "<>" ")". known_discriminant_part = "(" {+ discriminant_specification $ ";" +} ")". discriminant_specification = defining_identifier_list ":" ( subtype_mark | access_definition ) [ ":=" default_expression ]. default_expression = expression. -- 3.7.1 discriminant_constraint = "(" {+ discriminant_association $ "," +} ")". discriminant_association = [ {+ selector_name $ VERTICAL_BAR +} "=>" ] expression. -- 3.8 record_type_definition = [ [ "ABSTRACT" ] "TAGGED" ] [ "LIMITED" ] record_definition. record_definition = "RECORD" component_list "END" "RECORD" | "NULL" "RECORD". component_list = {+ component_item +} | { component_item } variant_part | "NULL" ";" . component_item = component_declaration | representation_clause. component_declaration = defining_identifier_list ":" component_definition [ ":=" default_expression ] ";" . -- 3.8.1 variant_part = "CASE" direct_name "IS" {+ variant +} "END" "CASE" ";" . variant = "WHEN" discrete_choice_list "=>" component_list. discrete_choice_list = {+ discrete_choice $ VERTICAL_BAR +}. discrete_choice = expression | discrete_range | "OTHERS". -- 3.9.1 record_extension_part = "WITH" record_definition. -- 3.10 access_type_definition = access_to_object_definition | access_to_subprogram_definition. access_to_object_definition = "ACCESS" [ general_access_modifier ] subtype_indication. general_access_modifier = "ALL" | "CONSTANT". access_to_subprogram_definition = "ACCESS" [ "PROTECTED" ] ( "PROCEDURE" parameter_profile | "FUNCTION" parameter_and_result_profile ). access_definition = "ACCESS" subtype_mark. -- 3.10.1 incomplete_type_declaration = "TYPE" defining_identifier [ discriminant_part ] ";". -- 3.11 declarative_part = pragmas_opt { declarative_item pragmas_opt }. declarative_item = basic_declarative_item | body. basic_declarative_item = basic_declaration | representation_clause | use_clause. body = proper_body | body_stub. proper_body = subprogram_body | package_body | task_body | protected_body. -- 4.1 name = ( direct_name | CHARACTER_LITERAL ) { explicit_dereference_b --| slice_b -- | indexed_component_b | selected_component_b | attribute_reference_b --| function_call_b -- | type_conversion_b | slice_b_or_function_call_b }. -- indexed_component_b and type_conversion_b are a subset of function_call_b direct_name = IDENTIFIER | operator_symbol. prefix = name. -- | implicit_dereference. explicit_dereference_b = "." "ALL". -- 4.1.1 indexed_component_b = "(" {+ expression $ "," +} ")". -- 4.1.2 -- slice = prefix "(" discrete_range ")". -- slice_b = "(" discrete_range ")". -- slice_b = "(" ( name ( -- subtype_indication_b -- | range_attribute_reference_b ) -- -- | simple_expression ".." simple_expression -- ) ")". -- slice_b without subtype_indication_b is included in function_call_b. -- 4.1.3 selected_component_b = "." selector_name. selector_name = IDENTIFIER | CHARACTER_LITERAL | operator_symbol. -- 4.1.4 attribute_reference_b = "'" attribute_designator. attribute_designator = IDENTIFIER [ "(" expression ")" ] | "ACCESS" | "DELTA" | "DIGITS". range_attribute_reference = prefix "'" range_attribute_designator. range_attribute_reference_b = "'" range_attribute_designator. range_attribute_designator = "RANGE" [ "(" expression ")" ]. -- 4.3 aggregate = record_aggregate | array_aggregate | extension_aggregate. -- 4.3.1 record_aggregate = "(" record_component_association_list ")". record_component_association_list = {+ record_component_association $ "," +} | "NULL" "RECORD". record_component_association = [ component_choice_list "=>" ] expression. component_choice_list = {+ selector_name $ VERTICAL_BAR +} | "OTHERS". -- 4.3.2 extension_aggregate = "(" ancestor_part "WITH" record_component_association_list ")". ancestor_part = expression. -- | subtype_mark. -- 4.3.3 array_aggregate = positional_array_aggregate | named_array_aggregate. positional_array_aggregate = "(" expression "," {+ expression $ "," +} ")" | "(" {+ expression $ "," +} "," "OTHERS" "=>" expression ")". named_array_aggregate = "(" {+ array_component_association $ "," +} ")". array_component_association = discrete_choice_list "=>" expression. -- 4.4 expression = {+ relation $ "AND" [ "THEN" ] | "OR" [ "ELSE" ] | "XOR" +}. relation = simple_expression ( [ relational_operator simple_expression ] | [ "NOT" ] "IN" ( range | subtype_mark) ). simple_expression = [ unary_adding_operator ] {+ term $ binary_adding_operator +}. term = {+ factor $ multiplying_operator +}. factor = primary [ "**" primary ] | "ABS" primary | "NOT" primary. primary = NUMERIC_LITERAL | "NULL" | STRING_LITERAL | name [ qualified_expression_b ] | aggregate | "(" expression ")" | allocator. -- 4.5 relational_operator = "=" | "/=" | "<" | "<=" | ">" | ">=". binary_adding_operator = "+" | "-" | "&". unary_adding_operator = "+" | "-". multiplying_operator = "*" | "/" | "MOD" | "REM". -- 4.6 type_conversion_b = "(" ( expression ) ")" . -- 4.7 qualified_expression = subtype_mark qualified_expression_b. qualified_expression_b = "'" ( "(" expression ")" | aggregate ). -- 4.8 allocator = "NEW" ( subtype_indication | qualified_expression ). -- 5.1 sequence_of_statements = pragmas_opt {+ statement +} pragmas_opt. statement = { label } pragmas_opt ( simple_statement | compound_statement ). simple_statement = null_statement | assignment_statement | procedure_call_statement | exit_statement | return_statement -- | entry_call_statement -- is the same as procedure_call | goto_statement | requeue_statement | delay_statement | abort_statement | raise_statement | code_statement. compound_statement = if_statement | case_statement | loop_statement | block_statement | accept_statement | select_statement. null_statement = "NULL" ";". label = "<<" statement_identifier ">>". statement_identifier = direct_name. -- 5.2 assignment_statement = name ":=" expression ";". -- 5.3 if_statement = "IF" condition "THEN" sequence_of_statements { "ELSIF" condition "THEN" sequence_of_statements } [ "ELSE" sequence_of_statements ] "END" "IF" ";". condition = expression. -- Must be a boolean_expression. -- 5.4 case_statement = "CASE" expression "IS" {+ case_statement_alternative +} "END" "CASE" ";". case_statement_alternative = "WHEN" discrete_choice_list "=>" sequence_of_statements. -- 5.5 loop_statement = [ statement_identifier ":" ] [ iteration_scheme ] "LOOP" sequence_of_statements "END" "LOOP" [ IDENTIFIER ] ";". iteration_scheme = "WHILE" condition | "FOR" loop_parameter_specification. loop_parameter_specification = defining_identifier "IN" ["REVERSE"] discrete_subtype_definition. -- 5.6 block_statement = [ statement_identifier ":" ] [ "DECLARE" declarative_part ] begin_end [ IDENTIFIER ] ";". begin_end = "BEGIN" handled_sequence_of_statements "END". -- 5.7 exit_statement = "EXIT" [name] ["WHEN" condition] ";". -- 5.8 goto_statement = "GOTO" name ";". -- 6.1 subprogram_declaration = subprogram_specification ";". abstract_subprogram_declaration = subprogram_specification "IS" "ABSTRACT" ";". subprogram_specification = "PROCEDURE" defining_program_unit_name parameter_profile | "FUNCTION" defining_designator parameter_and_result_profile. designator = [ parent_unit_name "." ] IDENTIFIER | operator_symbol. defining_designator = defining_program_unit_name | defining_operator_symbol. defining_program_unit_name = [ parent_unit_name "." ] defining_identifier. operator_symbol = STRING_LITERAL. defining_operator_symbol = operator_symbol. parameter_profile = [ formal_part ]. parameter_and_result_profile = [ formal_part ] "RETURN" subtype_mark. formal_part = "(" {+ parameter_specification $ ";" +} ")". parameter_specification = defining_identifier_list ":" (mode subtype_mark | access_definition ) [ ":=" default_expression ]. mode = [ "IN" ] [ "OUT" ]. -- 6.3 subprogram_body = subprogram_specification "IS" declarative_part begin_end [ designator ] ";". -- 6.4 procedure_call_statement = name [ actual_parameter_part ] ";". -- function_call = name | prefix actual_parameter_part. -- = name [ actual_parameter_part ]. function_call_b = actual_parameter_part. -- = "(" [ selector_name "=>" ] expression -- { "," [ selector_name "=>" ] expression } ")". -- = "(" ( expression -- { "," [ selector_name "=>" ] expression } -- | selector_name "=>" expression -- { "," [ selector_name "=>" ] expression } -- ) ")" actual_parameter_part = "(" {+ parameter_association $ "," +} ")". parameter_association = [ selector_name "=>" ] explicit_actual_parameter. explicit_actual_parameter = expression. slice_b_or_function_call_b = "(" ( expression ( subtype_indication_b | range_attribute_reference_b | ".." simple_expression | { "," [ selector_name "=>" ] expression } ) | selector_name "=>" expression { "," [ selector_name "=>" ] expression } ) ")". -- is unfortunately a superset of slice_b OR function_call_b, because -- expression is a superset of name. -- 6.5 return_statement = "RETURN" [ expression ] ";". -- 7.1 package_declaration = package_specification ";". package_specification = "PACKAGE" defining_program_unit_name "IS" pragmas_opt { basic_declarative_item pragmas_opt } [ "PRIVATE" pragmas_opt { basic_declarative_item pragmas_opt } ] "END" [ [ parent_unit_name "." ] IDENTIFIER ]. -- 7.2 package_body = "PACKAGE" "BODY" defining_program_unit_name "IS" declarative_part [ "BEGIN" handled_sequence_of_statements ] "END" [ [ parent_unit_name "." ] IDENTIFIER ] ";". -- 7.3 private_type_declaration = "TYPE" defining_identifier [ discriminant_part ] "IS" [ [ "ABSTRACT" ] "TAGGED" ] [ "LIMITED" ] "PRIVATE" ";". private_extension_declaration = "TYPE" defining_identifier [ discriminant_part ] "IS" [ "ABSTRACT" ] "NEW" subtype_indication "WITH" "PRIVATE" ";". -- 8.4 use_clause = use_package_clause | use_type_clause. use_package_clause = "USE" {+ name $ "," +} ";". use_type_clause = "USE" "TYPE" {+ subtype_mark $ "," +} ";". -- 8.5 renaming_declaration = object_renaming_declaration | exception_renaming_declaration | package_renaming_declaration | subprogram_renaming_declaration | generic_renaming_declaration. -- 8.5.1 object_renaming_declaration = defining_identifier ":" subtype_mark "RENAMES" name ";". -- 8.5.2 exception_renaming_declaration = defining_identifier ":" "EXCEPTION" "RENAMES" name ";". -- 8.5.3 package_renaming_declaration = "PACKAGE" defining_program_unit_name "RENAMES" name ";". -- 8.5.4 subprogram_renaming_declaration = subprogram_specification "RENAMES" name ";". -- 8.5.5 generic_renaming_declaration = "GENERIC" ( "PACKAGE" | "PROCEDURE" | "FUNCTION" ) defining_program_unit_name "RENAMES" name ";". -- 9.1 task_type_declaration = "TASK" ["TYPE"] defining_identifier [ known_discriminant_part ] [ "IS" pragmas_opt task_definition ] ";". single_task_declaration = "TASK" defining_identifier [ "IS" pragmas_opt task_definition ] ";". task_definition = { task_item } [ "PRIVATE" { task_item } ] "END" [ IDENTIFIER ]. task_item = entry_declaration | representation_clause. task_body = "TASK" "BODY" defining_identifier "IS" declarative_part begin_end [ IDENTIFIER ] ";". -- 9.4 protected_type_declaration = "PROTECTED" "TYPE" defining_identifier [ known_discriminant_part ] "IS" pragmas_opt protected_definition ";". single_protected_declaration = "PROTECTED" defining_identifier "IS" pragmas_opt protected_definition ";". protected_definition = { protected_operation_declaration } [ "PRIVATE" { protected_element_declaration } ] "END" [ IDENTIFIER ]. protected_operation_declaration = subprogram_declaration | entry_declaration | representation_clause. protected_element_declaration = protected_operation_declaration | component_declaration. protected_body = "PROTECTED" "BODY" defining_identifier "IS" { protected_operation_item } "END" [ IDENTIFIER ] ";". protected_operation_item = subprogram_declaration | subprogram_body | entry_body | representation_clause. -- 9.5.2 entry_declaration = "ENTRY" defining_identifier [ "(" discrete_subtype_definition ")" ] parameter_profile ";". accept_statement = "ACCEPT" direct_name [ "(" entry_index ")" ] parameter_profile [ "DO" handled_sequence_of_statements "END" [ IDENTIFIER ] ] ";". entry_index = expression. entry_body = "ENTRY" defining_identifier entry_body_formal_part entry_barrier "IS" declarative_part begin_end [ IDENTIFIER ] ";". entry_body_formal_part = [ "(" entry_index_specification ")" ] parameter_profile. entry_barrier = "WHEN" condition. entry_index_specification = "FOR" defining_identifier "IN" discrete_subtype_definition. -- 9.5.3 entry_call_statement = name [ actual_parameter_part ] ";". -- 9.5.4 requeue_statement = "REQUEUE" name [ "WITH" "ABORT" ] ";". -- 9.6 delay_statement = delay_until_statement | delay_relative_statement. delay_until_statement = "DELAY" "UNTIL" expression ";". delay_relative_statement = "DELAY" expression ";". -- 9.7 select_statement = selective_accept | timed_entry_call | conditional_entry_call | asynchronous_select. -- 9.7.1 selective_accept = "SELECT" [ guard ] select_alternative { "OR" [ guard ] select_alternative } [ "ELSE" sequence_of_statements ] "END" "SELECT" ";". guard = "WHEN" condition "=>". select_alternative = accept_alternative | delay_alternative | terminate_alternative. accept_alternative = accept_statement [ sequence_of_statements ]. delay_alternative = delay_statement [ sequence_of_statements ]. terminate_alternative = "TERMINATE" ";" . -- 9.7.2 timed_entry_call = "SELECT" entry_call_alternative "OR" delay_alternative "END" "SELECT" ";". entry_call_alternative = entry_call_statement [ sequence_of_statements ]. -- 9.7.3 conditional_entry_call = "SELECT" entry_call_alternative "ELSE" sequence_of_statements "END" "SELECT" ";". -- 9.7.4 asynchronous_select = "SELECT" triggering_alternative "THEN" "ABORT" abortable_part "END" "SELECT" ";". triggering_alternative = triggering_statement [ sequence_of_statements ]. triggering_statement = entry_call_statement | delay_statement. abortable_part = sequence_of_statements. -- 9.8 abort_statement = "ABORT" {+ name +}. -- 10.1.1 compilation = pragmas_opt { compilation_unit pragmas_opt }. compilation_unit = context_clause pragmas_opt ( library_item | subunit ). library_item = [ "PRIVATE" ] ( library_unit_declaration | library_unit_renaming_declaration ) | library_unit_body. library_unit_declaration = subprogram_declaration | package_declaration | generic_declaration | generic_instantiation. library_unit_renaming_declaration = package_renaming_declaration | generic_renaming_declaration | subprogram_renaming_declaration. library_unit_body = subprogram_body | package_body. parent_unit_name = name. -- 10.1.2 context_clause = { context_item pragmas_opt }. context_item = with_clause | use_clause. with_clause = "WITH" {+ name $ "," +} ";". -- 10.1.3 body_stub = subprogram_body_stub | package_body_stub | task_body_stub | protected_body_stub. subprogram_body_stub = subprogram_specification "IS" "SEPARATE" ";". package_body_stub = "PACKAGE" "BODY" defining_identifier "IS" "SEPARATE" ";". task_body_stub = "TASK" "BODY" defining_identifier "IS" "SEPARATE" ";". protected_body_stub = "PROTECTED" "BODY" defining_identifier "IS" "SEPARATE" ";". subunit = "SEPARATE" "(" parent_unit_name ")" proper_body. -- 11.1 exception_declaration = defining_identifier_list ":" "EXCEPTION" ";". -- 11.2 handled_sequence_of_statements = sequence_of_statements [ "EXCEPTION" {+ exception_handler +} ]. exception_handler = "WHEN" [ choice_parameter_specification ":" ] {+ exception_choice $ VERTICAL_BAR +} "=>" sequence_of_statements. choice_parameter_specification = defining_identifier. exception_choice = name | "OTHERS". -- 11.3 raise_statement = "RAISE" [ name ] ";". -- 12.1 generic_declaration = generic_subprogram_declaration | generic_package_declaration. generic_subprogram_declaration = generic_formal_part subprogram_specification ";". generic_package_declaration = generic_formal_part package_specification ";". generic_formal_part = "GENERIC" { generic_formal_parameter_declaration | use_clause }. generic_formal_parameter_declaration = formal_object_declaration | formal_type_declaration | formal_subprogram_declaration | formal_package_declaration. -- 12.3 generic_instantiation = "PACKAGE" defining_program_unit_name "IS" ( "NEW" | "PROCEDURE" | "FUNCTION" ) name [ generic_actual_part ] ";" | "PROCEDURE" defining_program_unit_name "IS" "NEW" name [ generic_actual_part ] ";" | "FUNCTION" defining_designator "IS" "NEW" name [ generic_actual_part ] ";". generic_actual_part = "(" {+ generic_association $ "," +} ")". generic_association = [ selector_name "=>" ] explicit_generic_actual_parameter. explicit_generic_actual_parameter = expression. -- | name | subtype_mark. -- 12.4 formal_object_declaration = defining_identifier_list ":" mode subtype_mark [ ":=" default_expression ] ";". -- 12.5 formal_type_declaration = "TYPE" defining_identifier [ discriminant_part ] "IS" formal_type_definition ";". formal_type_definition = formal_private_type_definition | formal_derived_type_definition | formal_discrete_type_definition | formal_signed_integer_type_definition | formal_modular_type_definition | formal_floating_point_definition | formal_ordinary_fixed_point_definition | formal_decimal_fixed_point_definition | formal_array_type_definition | formal_access_type_definition. -- 12.5.1 formal_private_type_definition = [ [ "ABSTRACT" ] "TAGGED" ] [ "LIMITED" ] "PRIVATE". formal_derived_type_definition = [ "ABSTRACT" ] "NEW" subtype_mark [ "WITH" "PRIVATE"]. -- 12.5.2 formal_discrete_type_definition = "(" "<>" ")". formal_signed_integer_type_definition = "RANGE" "<>". formal_modular_type_definition = "MOD" "<>". formal_floating_point_definition = "DIGITS" "<>". formal_ordinary_fixed_point_definition = "DELTA" "<>". formal_decimal_fixed_point_definition = "DELTA" "<>" "DIGITS" "<>". -- 12.5.3 formal_array_type_definition = array_type_definition. -- 12.5.4 formal_access_type_definition = access_type_definition. -- 12.6 replaced subprogram_default formal_subprogram_declaration = "WITH" subprogram_specification [ "IS" (name | "<>") ] ";". subprogram_default = default_name | "<>". default_name = name. -- 12.7 formal_package_declaration = "WITH" "PACKAGE" defining_identifier "IS" "NEW" name formal_package_actual_part ";". formal_package_actual_part = "(" "<>" ")" | [ generic_actual_part ]. -- 13.1 representation_clause = attribute_definition_clause | enumeration_representation_clause | record_representation_clause | at_clause. local_name = direct_name | direct_name "'" attribute_designator | name. -- 13.3 attribute_definition_clause = "FOR" local_name "'" attribute_designator "USE" ( expression ) ";". -- 13.4 enumeration_representation_clause = "FOR" local_name "USE" enumeration_aggregate ";". enumeration_aggregate = array_aggregate. -- 13.5.1 record_representation_clause = "FOR" local_name "USE" "RECORD" [ mod_clause ] { component_clause } "END" "RECORD" ";". component_clause = local_name "AT" position "RANGE" first_bit ".." last_bit ";". position = expression. first_bit = simple_expression. last_bit = simple_expression. -- 13.8 code_statement = qualified_expression ";". -- 13.12 -- J.3 delta_constraint = "DELTA" expression [ range_constraint ]. -- J.7 at_clause = "FOR" direct_name "USE" "AT" expression ";". -- J.8 mod_clause = "AT" "MOD" expression ";".