Annotated King Reference Manual/Statements

This page is work in progress.

Syntax
sequence_of_statements ::= statement {statement} statement ::= simple_statement | compound_statement simple_statement ::= null_statement | assignment_statement | exit_statement | procedure_call_statement | wait_statement | return_statement | end_statement compound_statement ::= if_statement | case_statement | loop_statement | declare_statement | task_declare_statement | select_statement null_statement ::= null; statement_identifier ::= direct_name

Rationale
-

Discussion
-

Syntax
assignment_statement ::=  variable_name <- expression;

Rationale
-

Discussion
-

Syntax
if_statement ::= simple_if_statement | extended_if_statement

simple_if_statement ::= if condition then sequence_of_statements [else sequence_of_statements] end if; extended_if_statement ::= if condition then sequence_of_statements else_if condition then sequence_of_statements {else_if condition then sequence_of_statements} else sequence_of_statements end if; condition ::= boolean_expression

Rationale
-

Discussion
-

Examples
-

Syntax
case_statement ::= normal_case_statement | exception_handling_case_statement

normal_case_statement ::= case selecting_expression is normal_case_statement_alternative {normal_case_statement_alternative} end case; normal_case_statement_alternative ::= when discrete_choice_list => sequence_of_statements

exception_handling_case_statement ::= case exception_identifier is exception_handling_case_statement_alternative {exception_handling_case_statement_alternative} end case; exception_handling_case_statement_alternative ::= when exception_occurrence_list => sequence_of_statements

Rationale
- Normal case statements may appear in any sequence of statements. Exception-handling case statements may only appear in an exception handler.

The exception_identifier must be the identifier following when of the enclosing exception handler.

Discussion
-

Syntax
loop_statement ::= loop_statement_identifier : [iteration_scheme] loop sequence_of_statements loop_identifier : end loop; iteration_scheme ::= for loop_parameter_specification | for loop_parameter_specification_no_reverse task | for iterator_specification [task] loop_parameter_specification ::= defining_identifier in [reverse] discrete_subtype_definition [iterator_filter] loop_parameter_specification_no_reverse ::= defining_identifier in discrete_subtype_definition [iterator_filter] discrete_subtype_definition ::= discrete_subtype_indication | range_specification iterator_specification ::= defining_identifier of iterable_name [iterator_filter] iterator_filter ::= when condition

Rationale
-

Discussion
-

Examples
-

Syntax
declare_statement ::= declare_statement_identifier: declare declarative_part declare_identifier : begin sequence_of_statements declare_identifier : when identifier => sequence_of_statements declare_identifier : end declare;

Rationale
-

Discussion
-

Examples
-

Syntax
task_declare_statement ::= task_declare_statement_identifier : task declare declarative_part task_declare_identifier : begin sequence_of_statements task_declare_identifier : and sequence_of_statements {task_declare_identifier : and sequence_of_statements} task_declare_identifier : end task declare;

Rationale
-

Discussion
-

Syntax
exit_statement ::= exit loop_name [when condition];

Rationale
-

Discussion
-

Syntax
wait_statement ::= wait wait_mode wait_expression; wait_mode ::= for | of

Rationale
The wait of statement is for a relative amount of time, and blocks the task for the number of seconds given. It can be read as, "Perform a wait of this many seconds." The wait for statement takes a Duration value and blocks the task until that time arrives, unless it is in the past. It can be read as, "Wait for this time to arrive." The duration is the number of seconds since the epoch, which is not defined, but meaningful values can be constructed using the standard library.

Discussion
-

Examples
-

Syntax
select_statement ::= select_statement_identifier : select blocking_call [sequence_of_statements] {select_identifier : or blocking_call [sequence_of_statements]} select_identifier : or wait_statement [sequence_of_statements] select_identifier : end select; blocking_call ::= assignment_statement | procedure_call_statement

Rationale
A blocking call would be a call to any subprogram of a passive task.

Discussion
-

Syntax
procedure_call_statement ::= procedure_prefix [actual_parameter_part]; actual_parameter_part ::= (parameter_association {, parameter_association}) parameter_association ::= formal_parameter_selector_name => explicit_actual_parameter explicit_actual_parameter ::= expression | variable_name

Rationale
-

Discussion
-

Syntax
return_statement ::= return [expression] [when condition];

Rationale
-

Discussion
-

Syntax
end_statement ::= end task_name;

Rationale
-

Discussion
-