715 lines
26 KiB
Plaintext
715 lines
26 KiB
Plaintext
================================================================================
|
|
While
|
|
================================================================================
|
|
|
|
procedure P is
|
|
begin
|
|
while True loop
|
|
exit;
|
|
exit when A > 0;
|
|
end loop;
|
|
end;
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(compilation
|
|
(compilation_unit
|
|
(proper_body
|
|
(subprogram_body
|
|
(subprogram_specification
|
|
(procedure_specification
|
|
(name
|
|
(identifier))))
|
|
(handled_sequence_of_statements
|
|
(sequence_of_statements
|
|
(statement
|
|
(compound_statement
|
|
(loop_statement
|
|
(iteration_scheme
|
|
(expression
|
|
(relation
|
|
(simple_expression
|
|
(term
|
|
(factor
|
|
(primary
|
|
(name
|
|
(identifier)))))))))
|
|
(sequence_of_statements
|
|
(statement
|
|
(simple_statement
|
|
(exit_statement)))
|
|
(statement
|
|
(simple_statement
|
|
(exit_statement
|
|
(expression
|
|
(relation
|
|
(simple_expression
|
|
(term
|
|
(factor
|
|
(primary
|
|
(name
|
|
(identifier))))))
|
|
(relational_operator)
|
|
(simple_expression
|
|
(term
|
|
(factor
|
|
(primary
|
|
(numeric_literal))))))))))))))))))))
|
|
|
|
================================================================================
|
|
For loops
|
|
================================================================================
|
|
|
|
procedure P is
|
|
begin
|
|
for E in Pkg.Arr'Range loop
|
|
goto end_loop;
|
|
|
|
<<end_loop>>
|
|
end loop;
|
|
|
|
for E of reverse Arr loop
|
|
delay 1.0;
|
|
end loop;
|
|
end P;
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(compilation
|
|
(compilation_unit
|
|
(proper_body
|
|
(subprogram_body
|
|
(subprogram_specification
|
|
(procedure_specification
|
|
(name
|
|
(identifier))))
|
|
(handled_sequence_of_statements
|
|
(sequence_of_statements
|
|
(statement
|
|
(compound_statement
|
|
(loop_statement
|
|
(iteration_scheme
|
|
(iterator_specification
|
|
(identifier)
|
|
(name
|
|
(identifier)
|
|
(name
|
|
(attribute_reference
|
|
(name
|
|
(identifier))
|
|
(tick)
|
|
(attribute_designator
|
|
(identifier)))))))
|
|
(sequence_of_statements
|
|
(statement
|
|
(simple_statement
|
|
(goto_statement
|
|
(name
|
|
(identifier)))))
|
|
(label
|
|
(identifier))))))
|
|
(statement
|
|
(compound_statement
|
|
(loop_statement
|
|
(iteration_scheme
|
|
(iterator_specification
|
|
(identifier)
|
|
(name
|
|
(identifier))))
|
|
(sequence_of_statements
|
|
(statement
|
|
(simple_statement
|
|
(delay_statement
|
|
(delay_relative_statement
|
|
(expression
|
|
(relation
|
|
(simple_expression
|
|
(term
|
|
(factor
|
|
(primary
|
|
(numeric_literal)))))))))))))))))
|
|
(name
|
|
(identifier))))))
|
|
|
|
================================================================================
|
|
Named loop
|
|
================================================================================
|
|
|
|
procedure P is
|
|
begin
|
|
Main:
|
|
loop
|
|
exit Main;
|
|
end loop Main;
|
|
end;
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(compilation
|
|
(compilation_unit
|
|
(proper_body
|
|
(subprogram_body
|
|
(subprogram_specification
|
|
(procedure_specification
|
|
(name
|
|
(identifier))))
|
|
(handled_sequence_of_statements
|
|
(sequence_of_statements
|
|
(statement
|
|
(compound_statement
|
|
(loop_statement
|
|
(loop_label
|
|
(identifier))
|
|
(sequence_of_statements
|
|
(statement
|
|
(simple_statement
|
|
(exit_statement
|
|
(name
|
|
(identifier))))))
|
|
(identifier))))))))))
|
|
|
|
================================================================================
|
|
Return
|
|
================================================================================
|
|
|
|
function F return Boolean is
|
|
begin
|
|
return True;
|
|
return A : My_Rec := (F => 1) do
|
|
null;
|
|
end return;
|
|
end F;
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(compilation
|
|
(compilation_unit
|
|
(proper_body
|
|
(subprogram_body
|
|
(subprogram_specification
|
|
(function_specification
|
|
(name
|
|
(identifier))
|
|
(parameter_and_result_profile
|
|
(result_profile
|
|
(name
|
|
(identifier))))))
|
|
(handled_sequence_of_statements
|
|
(sequence_of_statements
|
|
(statement
|
|
(simple_statement
|
|
(simple_return_statement
|
|
(expression
|
|
(relation
|
|
(simple_expression
|
|
(term
|
|
(factor
|
|
(primary
|
|
(name
|
|
(identifier)))))))))))
|
|
(statement
|
|
(compound_statement
|
|
(extended_return_statement
|
|
(extended_return_object_declaration
|
|
(identifier)
|
|
(return_subtype_indication
|
|
(subtype_indication
|
|
(name
|
|
(identifier))))
|
|
(assign_value
|
|
(expression
|
|
(relation
|
|
(simple_expression
|
|
(term
|
|
(factor
|
|
(primary
|
|
(aggregate
|
|
(record_aggregate
|
|
(record_component_association_list
|
|
(record_component_association
|
|
(component_choice_list
|
|
(selector_name
|
|
(identifier)))
|
|
(assoc_expression
|
|
(expression
|
|
(relation
|
|
(simple_expression
|
|
(term
|
|
(factor
|
|
(primary
|
|
(numeric_literal))))))))))))))))))))
|
|
(handled_sequence_of_statements
|
|
(sequence_of_statements
|
|
(statement
|
|
(simple_statement
|
|
(null_statement))))))))))
|
|
(name
|
|
(identifier))))))
|
|
|
|
================================================================================
|
|
Procedure call
|
|
================================================================================
|
|
|
|
procedure P (A : Integer) is
|
|
begin
|
|
P2 (1, False);
|
|
end P;
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(compilation
|
|
(compilation_unit
|
|
(proper_body
|
|
(subprogram_body
|
|
(subprogram_specification
|
|
(procedure_specification
|
|
(name
|
|
(identifier))
|
|
(non_empty_parameter_profile
|
|
(formal_part
|
|
(parameter_specification_list
|
|
(parameter_specification
|
|
(defining_identifier_list
|
|
(identifier))
|
|
(name
|
|
(identifier))))))))
|
|
(handled_sequence_of_statements
|
|
(sequence_of_statements
|
|
(statement
|
|
(simple_statement
|
|
(procedure_call_statement
|
|
(name
|
|
(identifier))
|
|
(actual_parameter_part
|
|
(parameter_association
|
|
(expression
|
|
(relation
|
|
(simple_expression
|
|
(term
|
|
(factor
|
|
(primary
|
|
(numeric_literal))))))))
|
|
(parameter_association
|
|
(expression
|
|
(relation
|
|
(simple_expression
|
|
(term
|
|
(factor
|
|
(primary
|
|
(name
|
|
(identifier)))))))))))))))
|
|
(name
|
|
(identifier))))))
|
|
|
|
================================================================================
|
|
Raise exception
|
|
================================================================================
|
|
|
|
procedure P is
|
|
begin
|
|
raise Constraint_Error;
|
|
raise Constraint_Error with "msg";
|
|
end;
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(compilation
|
|
(compilation_unit
|
|
(proper_body
|
|
(subprogram_body
|
|
(subprogram_specification
|
|
(procedure_specification
|
|
(name
|
|
(identifier))))
|
|
(handled_sequence_of_statements
|
|
(sequence_of_statements
|
|
(statement
|
|
(simple_statement
|
|
(raise_statement
|
|
(name
|
|
(identifier)))))
|
|
(statement
|
|
(simple_statement
|
|
(raise_statement
|
|
(name
|
|
(identifier))
|
|
(expression
|
|
(relation
|
|
(simple_expression
|
|
(term
|
|
(factor
|
|
(primary
|
|
(string_literal))))))))))))))))
|
|
|
|
================================================================================
|
|
Function calls
|
|
================================================================================
|
|
|
|
procedure P is
|
|
A : Integer;
|
|
begin
|
|
A := Func (B => 1);
|
|
end;
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(compilation
|
|
(compilation_unit
|
|
(proper_body
|
|
(subprogram_body
|
|
(subprogram_specification
|
|
(procedure_specification
|
|
(name
|
|
(identifier))))
|
|
(non_empty_declarative_part
|
|
(declarative_item_pragma
|
|
(object_declaration
|
|
(defining_identifier_list
|
|
(identifier))
|
|
(subtype_indication
|
|
(name
|
|
(identifier))))))
|
|
(handled_sequence_of_statements
|
|
(sequence_of_statements
|
|
(statement
|
|
(simple_statement
|
|
(assignment_statement
|
|
(name
|
|
(identifier))
|
|
(assign_value
|
|
(expression
|
|
(relation
|
|
(simple_expression
|
|
(term
|
|
(factor
|
|
(primary
|
|
(name
|
|
(function_call
|
|
(name
|
|
(identifier))
|
|
(actual_parameter_part
|
|
(parameter_association
|
|
(component_choice_list
|
|
(selector_name
|
|
(identifier)))
|
|
(assoc_expression
|
|
(expression
|
|
(relation
|
|
(simple_expression
|
|
(term
|
|
(factor
|
|
(primary
|
|
(numeric_literal))))))))))))))))))))))))))))
|
|
|
|
================================================================================
|
|
if statement
|
|
================================================================================
|
|
|
|
procedure P is
|
|
begin
|
|
if A = 0 or else B = 1 then
|
|
declare
|
|
begin
|
|
null;
|
|
end;
|
|
elsif A = 1 then
|
|
declare
|
|
C : Integer;
|
|
begin
|
|
null;
|
|
exception
|
|
when Constraint_Error => null;
|
|
end;
|
|
else
|
|
begin
|
|
null;
|
|
end;
|
|
end if;
|
|
end P;
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(compilation
|
|
(compilation_unit
|
|
(proper_body
|
|
(subprogram_body
|
|
(subprogram_specification
|
|
(procedure_specification
|
|
(name
|
|
(identifier))))
|
|
(handled_sequence_of_statements
|
|
(sequence_of_statements
|
|
(statement
|
|
(compound_statement
|
|
(if_statement
|
|
(expression
|
|
(relation
|
|
(simple_expression
|
|
(term
|
|
(factor
|
|
(primary
|
|
(name
|
|
(identifier))))))
|
|
(relational_operator)
|
|
(simple_expression
|
|
(term
|
|
(factor
|
|
(primary
|
|
(numeric_literal))))))
|
|
(relation
|
|
(simple_expression
|
|
(term
|
|
(factor
|
|
(primary
|
|
(name
|
|
(identifier))))))
|
|
(relational_operator)
|
|
(simple_expression
|
|
(term
|
|
(factor
|
|
(primary
|
|
(numeric_literal)))))))
|
|
(sequence_of_statements
|
|
(statement
|
|
(compound_statement
|
|
(block_statement
|
|
(handled_sequence_of_statements
|
|
(sequence_of_statements
|
|
(statement
|
|
(simple_statement
|
|
(null_statement)))))))))
|
|
(elsif_statement_item
|
|
(expression
|
|
(relation
|
|
(simple_expression
|
|
(term
|
|
(factor
|
|
(primary
|
|
(name
|
|
(identifier))))))
|
|
(relational_operator)
|
|
(simple_expression
|
|
(term
|
|
(factor
|
|
(primary
|
|
(numeric_literal)))))))
|
|
(sequence_of_statements
|
|
(statement
|
|
(compound_statement
|
|
(block_statement
|
|
(non_empty_declarative_part
|
|
(declarative_item_pragma
|
|
(object_declaration
|
|
(defining_identifier_list
|
|
(identifier))
|
|
(subtype_indication
|
|
(name
|
|
(identifier))))))
|
|
(handled_sequence_of_statements
|
|
(sequence_of_statements
|
|
(statement
|
|
(simple_statement
|
|
(null_statement))))
|
|
(exception_handler_list
|
|
(exception_handler
|
|
(exception_choice_list
|
|
(exception_choice
|
|
(name
|
|
(identifier))))
|
|
(sequence_of_statements
|
|
(statement
|
|
(simple_statement
|
|
(null_statement))))))))))))
|
|
(sequence_of_statements
|
|
(statement
|
|
(compound_statement
|
|
(block_statement
|
|
(handled_sequence_of_statements
|
|
(sequence_of_statements
|
|
(statement
|
|
(simple_statement
|
|
(null_statement))))))))))))))
|
|
(name
|
|
(identifier))))))
|
|
|
|
================================================================================
|
|
Case statement
|
|
================================================================================
|
|
|
|
procedure P is
|
|
begin
|
|
case Func(A => 1) is
|
|
when '1' .. '2' =>
|
|
null;
|
|
when '3' | '4' =>
|
|
null;
|
|
end case;
|
|
end;
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(compilation
|
|
(compilation_unit
|
|
(proper_body
|
|
(subprogram_body
|
|
(subprogram_specification
|
|
(procedure_specification
|
|
(name
|
|
(identifier))))
|
|
(handled_sequence_of_statements
|
|
(sequence_of_statements
|
|
(statement
|
|
(compound_statement
|
|
(case_statement
|
|
(expression
|
|
(relation
|
|
(simple_expression
|
|
(term
|
|
(factor
|
|
(primary
|
|
(name
|
|
(function_call
|
|
(name
|
|
(identifier))
|
|
(actual_parameter_part
|
|
(parameter_association
|
|
(component_choice_list
|
|
(selector_name
|
|
(identifier)))
|
|
(assoc_expression
|
|
(expression
|
|
(relation
|
|
(simple_expression
|
|
(term
|
|
(factor
|
|
(primary
|
|
(numeric_literal))))))))))))))))))
|
|
(case_statement_alternative
|
|
(discrete_choice_list
|
|
(discrete_choice
|
|
(range_g
|
|
(simple_expression
|
|
(term
|
|
(factor
|
|
(primary
|
|
(character_literal)))))
|
|
(simple_expression
|
|
(term
|
|
(factor
|
|
(primary
|
|
(character_literal))))))))
|
|
(sequence_of_statements
|
|
(statement
|
|
(simple_statement
|
|
(null_statement)))))
|
|
(case_statement_alternative
|
|
(discrete_choice_list
|
|
(discrete_choice
|
|
(expression
|
|
(relation
|
|
(simple_expression
|
|
(term
|
|
(factor
|
|
(primary
|
|
(character_literal))))))))
|
|
(discrete_choice
|
|
(expression
|
|
(relation
|
|
(simple_expression
|
|
(term
|
|
(factor
|
|
(primary
|
|
(character_literal)))))))))
|
|
(sequence_of_statements
|
|
(statement
|
|
(simple_statement
|
|
(null_statement))))))))))))))
|
|
|
|
================================================================================
|
|
Allocators
|
|
================================================================================
|
|
|
|
procedure P is
|
|
begin
|
|
A := new T;
|
|
A := new (pkg.pool) T'((F => 1));
|
|
end;
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(compilation
|
|
(compilation_unit
|
|
(proper_body
|
|
(subprogram_body
|
|
(subprogram_specification
|
|
(procedure_specification
|
|
(name
|
|
(identifier))))
|
|
(handled_sequence_of_statements
|
|
(sequence_of_statements
|
|
(statement
|
|
(simple_statement
|
|
(assignment_statement
|
|
(name
|
|
(identifier))
|
|
(assign_value
|
|
(expression
|
|
(relation
|
|
(simple_expression
|
|
(term
|
|
(factor
|
|
(primary
|
|
(allocator
|
|
(subtype_indication_paren_constraint
|
|
(name
|
|
(identifier))))))))))))))
|
|
(statement
|
|
(simple_statement
|
|
(assignment_statement
|
|
(name
|
|
(identifier))
|
|
(assign_value
|
|
(expression
|
|
(relation
|
|
(simple_expression
|
|
(term
|
|
(factor
|
|
(primary
|
|
(allocator
|
|
(subpool_specification
|
|
(name
|
|
(identifier)
|
|
(name
|
|
(identifier))))
|
|
(subtype_indication_paren_constraint
|
|
(name
|
|
(qualified_expression
|
|
(name
|
|
(identifier))
|
|
(tick)
|
|
(aggregate
|
|
(record_aggregate
|
|
(record_component_association_list
|
|
(record_component_association
|
|
(expression
|
|
(relation
|
|
(simple_expression
|
|
(term
|
|
(factor
|
|
(primary
|
|
(aggregate
|
|
(record_aggregate
|
|
(record_component_association_list
|
|
(record_component_association
|
|
(component_choice_list
|
|
(selector_name
|
|
(identifier)))
|
|
(assoc_expression
|
|
(expression
|
|
(relation
|
|
(simple_expression
|
|
(term
|
|
(factor
|
|
(primary
|
|
(numeric_literal))))))))))))))))))))))))))))))))))))))))))
|