The input to pic2lnt is a
PIC file, which must have the extension .pic
. If the user does not specify
the extension .pic
on the command line, it will be appended automatically
and pic2lnt will read filename.pic
as input.
The data types and functions
used in a PIC specification must be defined in external LOTOS NT files
.lib
, which must be included in the PIC file (see SPECIFICATION below).
The
output of pic2lnt is a LOTOS NT specification. The name of the input file
is used to construct the name of the output file. For an input file example.pic
,
pic2lnt creates the LOTOS NT specification example.lnt
.
An overview of PIC is given below. The abstract syntax of PIC is defined by an extended BNF (EBNF) grammar and the semantics of each PIC construct is defined informally. The EBNF grammar uses the following conventions: PIC keywords are enclosed between double quotes; a list of n elements is noted ELEM1 ... ELEMn; a list indexed from 0 (e.g., X0, ..., Xn) has at least one element; a list indexed from 1 (e.g., X1, ..., Xn) may have 0 elements; optional constructs are enclosed between square brackets.
The symbols of the PIC grammar are listed in the table below. The axiom of the grammar is the SPEC symbol.
+--------+---------------------------------+ | Symbol | Description | +----------+--------+---------------------------------+ | | SPEC | specification | | Non- | PROC | process definition | | terminal | DECL | channel or variable declaration | | | B | behaviour | +----------+--------+---------------------------------+ | | M | LOTOS NT module | | | C | channel | | | X | variable | | Terminal | F | function | | | OP | operator | | | T | type | | | K | constant | +----------+--------+---------------------------------+
Identifiers are built from letters, digits, and underscores (beginning
with a letter or an underscore). Keywords must be written in lowercase. Comments
are enclosed between "(*
" and "*)
" and may not be nested. pic2lnt is case-sensitive.
E ::= C | X | K | F [ "(" E1 "," ... "," En ")" ] | OP E | E1 OP E2 | E "of" T | E "." X | E "." "{" X0 "=>" E0, ..., Xn "=>" En "}" | E1 "[" E2 "]" | "(" E ")"
The semantics of PIC value expressions is defined informally below.
C
Channel names C are equipped with the standard comparison operators
"=
" and "<>
".
X
K
13
, -1
, 1.618
, 'a'
, '\007'
, '\n'
, "hello
world\n"
).
F [ "(" E1 "," ... "," En ")" ]
Note: If a name F without parentheses occurs in an expression, two cases are possible:
- If the name F does not correspond to a data variable previously declared, then F is interpreted as the free occurrence of a channel. If the name F denotes a function without arguments defined in some LOTOS NT library, then it must be written using parentheses (i.e., F ()) in order to avoid its interpretation as a free channel occurrence.
- If the name F corresponds both to a data variable and to a bound channel previously declared, then F is interpreted as a use occurrence of the data variable. If the name F must be interpreted as a channel name, then the name of the channel must be changed in order to avoid the clash with the name of the data variable.
OP E E1 OP E2
-
", "+
",
"*
", "<=
", etc.).
Syntactically, all binary operators are left-associative
and have the same precedence (hence, one should explicitly add parentheses
around subexpressions to ensure a desired evaluation order, e.g., write "x
+ (y * z)
" instead of "x + y * z
", which would be evaluated by default
as "(x + y) * z
"). All unary operators have the same precedence, which is
higher than the precedence of binary operators.
E "of" T
E "." X
E "." "{" X0 "=>" E0 "," ... "," Xn "=>" En "}"
E1 "[" E2 "]"
Nat
, which is predefined in LOTOS NT.
"(" E ")"
DECL ::= C | X ":" T
Variable declarations have also a generalized form:
X01 "," ... "," X0m0 ":" T0 "," ... "," Xn1 "," ... "," Xnmn ":" Tnwhich declares the data variables Xi1, ..., Ximi of type Ti for each 0 <= i <= n. This general form of declaration is equivalent to the simplified form below, which will be used in the remainder of this manual page:
X01 ":" T0 "," ... "," X0m0 ":" T0 "," ... "," Xn1 ":" Tn "," ... "," Xnmn ":" TnIn the same way, variable declarations with initialization have the following general form:
X01 "," ... "," X0m0 ":" T0 ":=" E0 "," ... "," Xn1 "," ... "," Xnmn ":" Tn ":=" Enwhich declares the data variables Xi1, ..., Ximi of type Ti and initializes them with the value of the expression Ei for each 0 <= i <= n. This general form of declaration with initialization is equivalent to the simplified form below, which will be used in the remainder of this manual page:
X01 ":" T0 ":=" E0 "," ... "," X0m0 ":" T0 ":=" E0 "," ... "," Xn1 ":" Tn ":=" En "," ... "," Xnmn ":" Tn ":=" En
B ::= "nil" | P [ "(" E0 "," ... "," En ")" ] | "tau" "." B | "'" C [ "<" E1 "," ... "," En ">" ] "." B | C [ "(" DECL1 "," ... "," DECLn ")" ] "." B | "[" E "]" B | "!" [ K ] B | "(" "new" C0 "," ... "," Cn ")" B | "var" X0 ":" T0 ":=" E0 "," ... "," Xn ":" Tn ":=" En "in" B "end" "var" | B1 "+" B2 | B1 "|" B2 | "(" B ")"
Syntactically, all binary operators are left-associative. Unary operators
(".
", "[
...]
", "!
", "new") have the highest precedence, followed by "|
", followed
by "+
".
The semantics of a PIC behaviour B is given by a Labeled Transition System (LTS) M = < S, A, T, s0 >, where: S is the set of states; A is the set of actions; T included in S * A * S is the transition relation; and s0 in S is the initial state. An action a of A is either the silent action i (this is the LOTOS NT notation, since the LTS denoting the semantics of a PIC behaviour is produced from the corresponding LOTOS NT code generated by pic2lnt), or it has the form c v1 ... vn, where c is a channel name and v1, ..., vn is a (possibly empty) list of channel names or data values exchanged during the rendezvous communication on channel c. This form of action corresponds to the early operational semantics of the pi-calculus (see, e.g., [MP95,Par01]). A transition (s1, a, s2) of T (also noted s1-a->s2) means that the system can move from state s1 to state s2 by performing action a. The semantics of PIC behaviours is described informally below.
"nil"
P [ "(" E0 "," ... "," En ")" ]
"tau" "." B
i
in LOTOS NT) and continues with the behaviour B.
"'" C [ "<" E1 "," ... "," En ">" ] "." B
C [ "(" DECL1 "," ... "," DECLn ")" ] "." B
All channel names and variables declared by DECL1, ..., DECLn are visible in B.
"[" E "]" B
if E then B1 else B2 = [ E ] B1 + [ not (E) ] B2
"!" [ K ] B
Nat
. If K is absent, it has the default value 1, meaning that the
bounded replication operator is a shorthand for B.
"(" "new" C0 "," ... "," Cn ")" B
"var" X0 ":" T0 ":=" E0 "," ... "," Xn ":" Tn ":=" En "in" B "end" "var"
The variables X0, ..., Xn are visible in B.
B1 "+" B2
B1 "|" B2
"(" B ")"
PROC ::= P [ "(" DECL1 "," ... "," DECLn ")" ] "=" B
This defines the process P, equipped with the optional (channel or variable) parameters declared by DECL1, ..., DECLn. The parameters are visible in the behaviour B, which is the body of process P. A process P without parameters can be called using the syntax P or P(). Processes can be mutually recursive.
Note: The current version of pic2lnt handles only PIC specifications satisfying the finite control property [Dam94], which forbids recursive process calls through the parallel composition operator. This hypothesis was used in the translation from polyadic pi-calculus to LOTOS NT [MS10] and was maintained for the translation from PIC to LOTOS NT.
For example, the process definition below does not satisfy the finite control property:
P = P | (a . nil)
Note: Recursive process calls through the channel creation operator are permitted. For instance, the following process definition is handled by pic2lnt:
Q = (new b) (b . Q)
A call to process Q yields an infinite LTS, because each recursive call
will generate a new transition labeled by a fresh channel name "b (n)
"
for n >= 0. Therefore, trying to generate the LTS of a call to process Q
will exhaust the memory available on the host computer.
SPEC ::= [ "library" M0 "," ..."," Mm "end" "library" ] PROC0 ... PROCn
If present, the module identifiers M0, ..., Mm must correspond to LOTOS
NT files named M0.lib
, ..., Mm.lib
present in the current directory (letter
case is not significant). The LOTOS NT modules M0, ..., Mm must define all
the data types and functions used in the process definitions PROC0, ..., PROCn.
If the "library" clause is absent, the PIC specification is dataless, i.e.,
it contains only polyadic pi-calculus agent definitions.
a
, b
are public channels and c
is a private
channel (i.e., defined by a "new" operator), will yield an LTS transition
labeled by the following action:
PUBLIC !PUB (A_0) !PUB (B_0) !PRIV (C_1 (1)) !3 !TRUE
Starting from a PIC specification filename.pic
, the corresponding LTS can
be produced by applying pic2lnt and then generating the LTS filename.bcg
,
encoded in the BCG file format, of the resulting LOTOS NT specification.
This LTS can be made compatible with the original pi-calculus semantics
by renaming its actions using bcg_labels
and the renaming files
present in $PIC/incl as follows:
bcg_labels -rename -multiple $PIC/incl/pic_renaming_1.ren -rename -multiple $PIC/incl/pic_renaming_2.ren -rename $PIC/incl/pic_renaming_3.ren filename.bcg
Note: this renaming does not delete the suffixes "_k" of the channel names, in order to facilitate the understanding of the PIC behaviours that are not in normal form (i.e., contain both free and bound occurrences of the same channel name(s)).
+-----------------+-----------------------------------------+ | pi-calculus | Mobility Workbench (MWB) | | construct | syntax | +=================+=========================================+ | empty | "0" | +-----------------+-----------------------------------------+ | silent prefix | "t" "." B | +-----------------+-----------------------------------------+ | emission | "'" C "<" C1 ... Cn ">" "." B | +-----------------+-----------------------------------------+ | reception | C "(" C1 ... Cn ")" "." B | +-----------------+-----------------------------------------+ | channel | "(" "new" C0 ... Cn ")" B | | creation | "(" "^" C0 ... Cn ")" B | | | "(" "^" C0 "," ... "," Cn ")" B | +-----------------+-----------------------------------------+ | process (agent) | "agent" P [ "(" C0 "," ... "," Cn ")" ] | | definition | "=" B | +-----------------+-----------------------------------------+
.lnt
produced as output by pic2lnt. To compile filename.lnt
using lnt2lotos
or lnt.open
, the file $PIC/incl/pic2lnt_dyn.tnt
should be copied in the current directory and renamed into filename.tnt
.