|
LCS-2016-007a |
|
1 {24-Jan-2017} 2 {02-Feb-2017} 3 {07-Feb-2017} |
|
07-Feb-2017 |
|
Voting |
|
Patrick Lehmann Jim Lewis |
|
Main.PatrickLehmann Main.JimLewis |
|
Sequential Declaration Regions |
|
Adds a short form for "Sequential Declaration Regions". |
begin
reserved word in all sequential statements which support
a list of nested statements.
Version 2: if_statement ::= [ if_label : ] if condition thenIf a label appears at the end of an if statement, it shall repeat the if label. For the execution of an if statement, the condition specified aftersequence_of_statementssequential_statement_body { elsif condition thensequence_of_statementssequential_statement_body } [ elsesequence_of_statementssequential_statement_body ] end if [ if_label ] ; sequential_statement_body ::= [ sequential_statement_declarative_part begin ] sequence_of_statements sequential_statement_declarative_part ::= { process_declarative_item }
case_statement ::=
[ case_label : ]
case [ ? ] expression is
case_statement_alternative
{ case_statement_alternative }
end case [ ? ] [ case_label ] ;
case_statement_alternative ::=
when choices =>
sequence_of_statements
sequential_statement_body
A case statement shall include the question mark delimiter either in both places, in which case the case statement is called a matching case
loop_statement ::=
[ loop_label : ]
[ iteration_scheme ] loop
sequence_of_statements
sequential_statement_body
end loop [ loop_label ] ;
iteration_scheme ::=
while condition
| for loop_parameter_specification
parameter_specification ::=
identifier in discrete_range
If a label appears at the end of a loop statement, it shall repeat the label at the beginning of the loop statement.
Execution of a loop statement is complete when the loop is left as a consequence of the completion of the iteration scheme (see the if_statement ::= [ if_label : ] if condition then[New EBNF rule]sequence_of_statementssequential_statement_body { elsif condition thensequence_of_statementssequential_statement_body } [ elsesequence_of_statementssequential_statement_body ] end if [ if_label ] ; case_statement_alternative ::= when choices =>sequence_of_statementssequential_statement_body loop_statement ::= [ loop_label : ] [ iteration_scheme ] loopsequence_of_statementssequential_statement_body end loop [ loop_label ] ;
sequential_statement_body ::=
[ sequential_statement_declarative_part
begin ]
sequence_of_statements
sequential_statement_declarative_part ::=
{ process_declarative_item }
[ end [ alternative_label ] ; ]
part.
There is already an end in the outer structure (e.g loop
, ...).
It is also unclear to me what alternative_label
label should point o.
-- Hendrik Eeckhaut - 2017-01-23
case
statement as this would create the first awkward situation of a begin
without an end
.
-- Thomas Preusser - 2017-01-24
This LCS does not replace LCS-2016-007, in contrast it relies on it. Otherwise I could not describe such a transformation. It is an extension to
cover the most common use case of one seq. block statement per seq. statement.
I love end foo
, but I'm against an additional end in case statement alternatives. See the case generate statement for a negative example.
-- Patrick Lehmann - 2017-01-25
I see the sequential block statement (007) as something I need infrequently. Although I like the syntax form of this, I am having a hard time
convincing myself that I would actually use this, and hence, I am having a hard time justifying asking vendors to implement it.
-- Jim Lewis - 2017-01-25
I think I'm with Jim here. It seems like 007 would allow you to accomplish all this anyhow, by wrapping the if/for/while in a
sequential_block_statement. Or for that matter, wrapping a sequential_block_statement inside the if/for/while. 007 exists because there are use
cases that can't be met without it. Is there a similar case here?
-- Rob Gaddi - 2017-01-26
begin
without end
in case statements would be awkward. Same applies to an if
/ elsif
block followed by an
elsif
or else
block.elsif
, the 1st sentence must be extended as follows (the blue part):
The equivalent if statement contains as many elsif branches as the original statement contains with the same conditions and in the
same order.
-- Martin Zabel - 2017-01-30
Why should I add a rule for an optional end
keyword like in generate statements, when nobody ever uses it? Every elsif
, else
or when
has
the same meaning as end
. This is not Pascal, where begin .. end
is equal to { ... }
like in C. A begin
keyword is a delimiter between the
declarative part and statement part -- at least in my eyes.
-- Patrick Lehmann - 2017-01-30
Accepted, having a begin
without end
is just a matter of style. The other issues of my last comment still persist.
-- Martin Zabel - 2017-02-02
Two things you might consider:
TBP#1: sequential_statement_body
does not quite sound right as it suggests to be a part of a single statement. Maybe, naming it sequential_section
or sequential_bock_body
is getting closer.
TBP#2: The semantic description is based on a transformation to a sequential block
statement. This creates unnecessary dependency chains through the LRM. I would prefer a flatter hierarchy and define the semantics bottom up based on a common sequential_section
or something similar that is used by both the sequential block
statement and the control-flow structures. I believe that this will also create a significantly shorter update combining 007 and 007a as the description of the transformation can be dropped.
-- Thomas Preusser - 2017-02-03
TBP: sequential_statement_body
does not quite sound right as it suggests to be a part of a single statement.
PL: Please see Annex C. EBNF rules with suffix _body
mostly contain *_declarative_part
-> begin
-> statements -> end productions.
TBP: The semantic description is based on a transformation to a sequential block statement. This creates unnecessary dependency chains through the LRM.
PL: A major parts of the LRM are written as transformations. E.g. generated statements are block statements, entities are block statements as well,
every concurrent assignment or concurrent procedure call is translated into a process, ...
-- Patrick Lehmann - 2017-02-03
PL: Please see Annex C. EBNF rules with suffix _body mostly contain *_declarative_part -> begin -> statements -> end productions.
TBP: Arguing this way, you would need to call it sequential_statement_list_body
because it is a list and not a statement.
PL: A major parts of the LRM are written as transformations.
TBP: Sometimes transformations make life easier. Concurrent assignments are most easily described this way and a bottom-up composition is not really an option. I do not see any such advantage or even need here.
-- Thomas Preusser - 2017-02-03
TBP: Arguing this way, you would need to call it sequential_statement_list_body because it is a list and not a statement.
PL: The suffix _list
is used for unordered lists; otherwise it's a sequence. Regarding the use of _body
: see architecture_body
, generate_statement_body
, subprogram_body
, package_body
and finally protected_type_body
. They all fit into the scheme *_declarative_part
-> begin
-> statements -> end
.
TBP: I do not see any such advantage or even need here.
PL: You can still submit alternative LCS' until mid of February. I've written a lot of LCS'. I have to write some new LCS' and I also have to finalize three LCS' in the next two weeks. So I won't change anything, other then for technical objections.
-- Patrick Lehmann - 2017-02-03
While I like the idea, I still think this LCS requires a careful consistency check: sequential_statement_body
is misleading.
generate
statements. They are concurrent - well with the exception of their declarative part. Is this what you are after?
-- Thomas Preusser - 2017-02-07
Thanks! This is a great compromise avoiding both a significant rewrite and extreme verbosity. Good job.
The added paragraphs in 10.9 and 10.10 are only classified as notes. This appears a little like an understatement to me. But I will not object.
PS: Fixed a few minor typos.
-- Thomas Preusser - 2017-02-08