Part 4: RSDL Formal Definition
4.3 Static Semantics
4.3.4 Agents
4.3.4.4 Number of Instances
Abstract Syntax
Number-of-instances :: Initial-number [ Maximum-number ]
Initial-number = INT
Maximum-number = INT
Conditions on Abstract Syntax
∀n ∈ Number-of-instances: n.s-Maximum-number ≠ undefined ⇒ n.s-Initial-number ≤ n.s-Maximum-number ∧ n.s-Maximum-number > 0
The <initial number> of instances must be less than or equal to <maximum number> and <maximum number>
must be greater than zero.
Concrete Syntax
<number of instances> :: [<initial number>] [<maximum number>]
<initial number> = <Integer<name>
<maximum number> = <Integer<name>
Conditions on Concrete Syntax
∀ n ∈ <number of instances>: n.s-<initial number> ≠ undefined ⇒ n.s-<initial number>.s-TOKEN.isIntToken
The initial number must be of type Integer.
∀ n ∈ <number of instances>: n.s-<maximum number> ≠ undefined ⇒ n.s-<maximum number>.s-TOKEN.isIntToken
The maximum number must be of type Integer.
Transformations
<number of instances>(undefined, max) =3=> <number of instances>(<name>(“1”), max) If <initial number> is omitted, then <initial number> is 1.
n=<number of instances>(ini, undefined)
provided n.parentAS0.parentAS0.parentAS0 ∈ <rsdl specification>
=3=> <number of instances>(ini, <name>(“1”))
In the outermost Agent the Maximum-number of instances is 1.
Mapping to Abstract Syntax
| <number of instances>(i, m) =>
mk-Number-of-instances(i.s-TOKEN.getIntValue,
if m= undefined then undefined else m.s-TOKEN.getIntValue endif )
4.3.5 Variables
Abstract Syntax
Variable-definition :: Variable-name Sort-name
[ Constant-expression ]
Conditions on Abstract Syntax
∀d ∈ Variable-definition: s-Constant-expression(d) ≠ undefined ⇒ sortCompatible(exprSort(s-Constant-expression(d)), s-Sort-name(d))
If the Constant-expression is present, it must be of the same sort as the one denoted by Sort-name.
Concrete Syntax
<variable definition> :: [exported] {<variables of sort>}+
<variables of sort> :: <variable<name>+ <sort> [<constant expression>]
Auxiliary Functions
myImplicitVariableName(v: <variable definition>): <name> =def
<name>(“imc” ∩ v.s-<variables of sort>-seq.head.s-<name>-seq.head.s-TOKEN ) We introduce a function for the implicit variable name of exported variables.
controlled statesInserted: <variable definition> → BOOLEAN
We introduce a controlled function for remembering if the remote variable handling was already inserted into the states.
Transformations
< <variables of sort>(< n > ∩ r, s, e) > provided r ≠ empty
=3=> < <variables of sort>(< n >, s, e), <variables of sort>(r, s, e) >
Multiple variable definitions are separated.
< <variable definition>(e, < v > ∩ r) > provided r ≠ empty
=3=> < <variable definition>(e, < v >), <variable definition>(e, r) >
Multiple variable definitions are separated.
v=<variable definition>(exported, < <variables of sort>(< n >, s, e) > ) provided myImplicitVariableName(v).refersto0 = undefined
=5=> < v, <variable definition>(undefined,
< <variables of sort>(< myImplicitVariableName(v) >, s, e) > ) >
For every exported variable, an implicit variable is defined.
v=<variable definition>(exported, *) provided statesInserted(v) = False =5=> v
and statesInserted(v) := True
and do forall s: s ∈ v.parentAS0.s-<agent type body>.s-implicit ∧ s ∈ <basic state>
let newInput = <input part>(< <stimulus>(v.myQuerySignalIdentifier, empty) >,
< <action statement>(<output>(<output body>(
< <output body gen identifier>(v.refersto0.myReplySignalIdentifier,
<actual parameters>(< <identifier>(v.fullPath, v.myImplicitVariableName) > ) ) >, <operand5>(undefined, sender) ) ) ) >,
<terminator statement>(undefined, <nextstate>(s.s-<state list>.head)) ) in
=> <basic state>(s.s-<state list>, s.s-implicit∩ newInput, s.s-<name>)
To all <state>s of the exporter, excluding implicit states derived from import, the following <input part> is added:
input xQUERY;
output xREPLY(imcx) to sender;
nextstate the state containing this input;
imcx denotes the implicit copy of the exported variable.
The above rule actually states three parallel transformations: First, the variable definition v is replaced by itself.
Additionally, the value of statesInserted(v) is set to True. Moreover, all states within the enclosing agent structure are modified.
Mapping to Abstract Syntax
| <variable definition>(*, < var >) => Mapping(var)
| <variables of sort>(< name >, sort, const)
=> mk-Variable-definition(Mapping(name), Mapping(sort), Mapping(const))
4.3.6 Communication
4.3.6.1 Signal
Abstract Syntax
Signal-definition :: Signal-name Sort-name*
Concrete Syntax
<signal definition>:: <signal definition item>+
<signal definition item> :: <signal<name> [<sort list>]
<sort list> :: {<sort>}+
Transformations
< <signal definition>(< i > ∩ r) > provided r ≠ empty
=3=> < <signal definition>(< i >), <signal definition>(r) >
Multiple signal definitions are separated.
Mapping to Abstract Syntax
| <signal definition>(<<signal definition item>(name, sorts) >) => mk-Signal-definition(Mapping(name),
if sorts=undefined then empty else Mapping(sorts) endif)
| <sort list>(sorts) => Mapping(sorts)
4.3.6.2 Gate
Abstract Syntax
Gate-definition :: Gate-name
In-signal-identifier-set
Out-signal-identifier-set
In-signal-identifier = Signal-identifier Out-signal-identifier = Signal-identifier Concrete Syntax
<gate in definition> = <textual gate definition>
<textual gate definition> :: <gate> <gate constraint> [<gate constraint>]
<gate> = <gate<name>
<gate constraint> :: { out | in } <signal list>
<signal list> = {<signal list item>}+
<signal list item> = <identifier>
Auxiliary Functions
findSignalset(c: <gate constraint>, t: TOKEN): DefinitionAS0* =def
if c=undefined then empty
elseif c.s-implicit = t then c.s-<signal list>
else empty endif
We introduce an auxiliary function to extract the signal list per direction.
Conditions on Concrete Syntax
∀ g ∈ <textual gate definition>: g.s2-<gate constraint> ≠ undefined ⇒ g.s-<gate constraint>.s-implicit ≠ g.s2-<gate constraint>.s-implicit
Where two <gate constraint>s are specified one must be in the reverse direction to the other.
Mapping to Abstract Syntax
| <textual gate definition>(g, c1, c2) =>
mk-Gate-definition(Mapping(g),
Mapping(findSignalset(c1, in)).toSet ∪ Mapping(findSignalset(c2, in)).toSet, Mapping(findSignalset(c1, out)).toSet ∪ Mapping(findSignalset(c2, out)).toSet)
In the mapping to the AS1 the gate constraints must be extracted per direction. See the definition of findSignalset above.