Hi Thomas, Theo,
My interpretation of what “first statement of an alternative” is exactly as
Theo describes it.
The BNF disallows this. See A.1.6.7 Behaviour statements, BNF rules: 530,
540, 541, 542, 543, 544, 545 and 546.
Label is a basic program statement (see 19 Basic program statements).
alt{
label impossible; // the following is impossible. label would need
to be preceded by an AltGuardChar (545), Else, or semicolon.
[] PCO1.receive(MySig1) // interpret as first statement of an
alternative. See (1)
{
alt{
[] label impossible; // the following is also impossible. Since
label is not part of GuardOp production 546.
[] PCO1.receive(MySig1) // interpret as top alternative in an alt
statement, interleave statement or altstep.
{ // See (2)
"A label statement can be used freely like other TTCN-3 behavioural program
statements according to the
syntax rules defined in annex A. It can be used before or after a TTCN-3
statement but not as the first statement of an
alternative (1) or top alternative in an alt statement (2) , interleave
statement or altstep."
In both cases (1) and (2), the BNF definition prevents either of these
constructions to be recognized as valid. That is, the BNF disallows (1) and
(2).
A good tool would catch both these types of syntactic errors.
Looking at why both these constructions are not permitted, my guess would be
that it breaks the intent of snapshot semantics. See 20.1 the snapshot
mechanism of
ES20187301-3.2.1 and section 9.3 of ES20187304-3.2.1
Snapshot semantics dictate that a new snapshot is taken each time the alt
keyword is encountered. Allowing either of the above (1) and (2)
would permit running through a list of alternatives (using gotos ) without
taking a new snapshot. I believe this is something that one wants to avoid.
Since the content of port ‘queues’ as well as timer values are ‘frozen’ for
the duration of a snapshot no new information has been gained ( apart from
Possible variable values which may have changed.
Cheers,
Claude.
Blue Cactus Consulting phone: +49 (0)30 9606 7985
Edinburger Str. 39 fax: +49 (0)30 9606 7987
13349 Berlin mobile: +49 (0)174 701 6792
Germany email: This email address is being protected from spambots. You need JavaScript enabled to view it.
_____
From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
Sent: 04 September 2007 10:12
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Label question
Hello,
According to the BNF, the definition of label L2 would be ok. Also, I cannot
really see a reason why this should be prohibited.
Are there any ideas out there, what then the 'first statement of an
alternative' would mean?
Btw., I checked version 3.2.1. and it does contain the same explanation.
Best regards
Thomas
| Thomas Deiß |
| Nokia Networks GmbH |
| Meesmannstraße 103 |
| D-44807 Bochum |
| Mobile: +49 1639842217 |
| Direct: +49 2349842217 |
| Fax: +49 2349843491 |
| email: This email address is being protected from spambots. You need JavaScript enabled to view it. |
_____
From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of ext xuezhi xing
Sent: Tuesday, 04. September 2007 10:00
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Label question
Hi all
I have a question when read about core language 19.4 (2005 version).
It says "A label statement can be used freely like other TTCN-3 behavioural
program statements according to the
syntax rules defined in annex A. It can be used before or after a TTCN-3
statement but not as the first statement of an
alternative or top alternative in an alt statement, interleave statement or
altstep."
But in the following example,it gives :
EXAMPLE:
label MyLabel; // Defines the label MyLabel
// The labels L1, L2 and L3 are defined in the following TTCN-3 code
fragment
:
label L1; // Definition of label L1
alt{
[] PCO1.receive(MySig1)
{
label L2; // Definition of label L2
PCO1.send(MySig2);
PCO1.receive(MySig3)
}
[] PCO2.receive(MySig4)
{
PCO2.send(MySig5);
PCO2.send(MySig6);
label L3; // Definition of label L3
PCO2.receive(MySig7);
}
}
Here I think the label L2's definition is error according to the description
above."It can be used before or after a TTCN-3 statement but not as the
first statement of an alternative"
How do you think? thanks