The CONVECS team is pleased to announce
that version 3.13 of the TRAIAN compiler for LNT/LOTOS NT is available.
In October 2023, TRAIAN became part of the CADP toolbox, where it provides a full-fledged compiler front-end for the LNT language, allowing to catch mistakes not detected by the "lightweight" approach of the LNT2LOTOS translator. Precisely, TRAIAN 3.12 was integrated in CADP 2024-a; later, TRAIAN 3.13 beta 2 became part of CADP 2024-b and TRAIAN 3.13 beta 5 became part of CADP 2024-c.
TRAIAN 3.13 brings three language changes, twelve static-semantics changes, four code-generation changes, one release change, and five bug fixes (see below their description).
select B1 [] ... [] Bn end selectmay also be written, equivalently:
alt B1 [] ... [] Bn end altThe reasons for this evolution are threefold:
From now on, "select" is deprecated. The use of "alt" should be preferred when writing new LNT programs. The evolution is scheduled in three steps:
Users are advised to upgrade their LNT programs by running the following command:
traian_upc 2024-LOTNT-SELECT [<file> or <directory>]which will replace "select" by "alt" automatically. See item 619 in the HISTORY.txt file.
Users are advised to upgrade their LNT programs by running the following command:
traian_upc 2024-LOTNT-EXIT [<file> or <directory>]which will automatically replace NONE by EXIT for the event parameters of functions. This only applies to functions: process definitions that declare exceptions must be updated manually (fortunately, such definitions are less frequent than functions raising exceptions).
The editor style files (in directory "$LNTDIR/ext") have been updated to recognize EXIT as a predefined channel, in the same way as NONE. See item 620 in the HISTORY.txt file.
The former syntax:
trap exception E1 is I1, ..., exception En is In in I0 end traphas been replaced with:
trap E1:exit -> I1 | ... | En:exit -> In in I0 end trap(same for behaviours B0, B1, ..., Bn).
Users are advised to upgrade their LNT programs by running the following command:
traian_upc 2024-LOTNT-TRAP [<file> or <directory>]which will update "trap" constructs automatically.
Consequently, "exception" is no longer a reserved keyword. The editor style files (in directory "$LNTDIR/ext") have been updated accordingly. See item 621 in the HISTORY.txt file.
useless assignment to Xis now displayed more often, especially when a branch of a "par" statement assigns variable X, e.g.:
X := 0; -- warning: useless assignment to X Y := 0; -- warning: useless assignment to Y par X := 1 || G (?Y) end par; PRINT (X, Y)See item 604 in the HISTORY.txt file.
"out" parameter X both used and modified (should be an "out var" parameter)when variable X is only used in an input guard, e.g.:
process P [G: any] (out X: Nat) is G (?X) where X < 10 end processor in the "where" clause of a nondeterministic assignment:
process P [G: any] (out X: Nat) is X := any Nat where X < 10 end processSimilarly, the warning:
"out var" parameter X never used (should be an "out" parameter)is no longer displayed when variable X is only used in the "where" clause of an input or a nondeterministic assignment, e.g.:
process P (out var X: Int) is X := any Int where (X >= 0) and (X < 10) end processSee item 606 in the HISTORY.txt file.
"in out" parameter X modified before used (should be an "out" parameter)is now displayed more often, e.g., in the following example:
function F (B: Bool, in out X: Nat): Nat is loop L in if B then X := 0 else X := 1 end if; ... end loop end functionSee item 607 in the HISTORY.txt file.
useless assignment to Xmore often in presence of loops that do not terminate, e.g.:
loop X := 1 -- warning: useless assignment to X end loopor:
X := 0; -- warning: useless assignment to X loop X := any Nat where X < 10; ... end loopor:
loop L in if B then X := 0; break L end if; X := 1 -- warning: useless assignment to X end loopSee item 608 in the HISTORY.txt file.
a) From now on, if a module has a "with F" clause, where F is either NIL, CONS, or INSERT, TRAIAN emits a warning:
useless clause "with F" in module Mb) From now on, if a list, sorted list, or set type T has a "with F" clause, where F is either NIL, CONS, or INSERT, with no pragma (namely, !implementedby or !external) attached to this clause, TRAIAN emits a warning:
useless clause "with F" in type TIn both cases, the "with" clause is indeed useless since:
See item 609 in the HISTORY.txt file.
function F [E : none] (X : BOOL, out Y : BOOL) : BOOL is trap exception Y is X := false exception Z is raise E in loop raise Z end loop end trap; return X or Y end functionTRAIAN now displays:
"in" parameter X modified (should be an "in var" parameter)rather than:
"in" parameter X modified before used (should be a local variable)See item 612 in the HISTORY.txt file.
useless assignment to Xare now displayed by TRAIAN, e.g.
process MAIN [PRINT : any] (out X : BOOL) is X := true; -- warning: useless assignment to X stop end processSee item 613 in the HISTORY.txt file.
unreachable "ensure" (dead code) after infinite loop unreachable "ensure" (dead code) after "stop"See item 614 in the HISTORY.txt file.
superfluous pattern(s) after the Nth patternwhen the previous patterns from 1 to (N-1) already cover all possible cases. In practice, these new warnings enable one to detect and simplify LNT programs containing useless patterns (such as extra patterns "any -> null" that were formerly required by TRAIAN 2.x). See item 615 in the HISTORY.txt file.
- function with "out" parameter(s) but looping infinitely - infinite loopand:
- function with result but looping infinitely - infinite loopare replaced by a single error message:
function looping infinitelywhich is less ambiguous, as it does not suggest that functions having neither "out" parameters nor result are allowed not to terminate. The messages emitted by TRAIAN for processes that contain infinite loops are kept unchanged. See item 616 in the HISTORY.txt file.
unreachable behaviour (dead code) after ...by removing, from the "..." list, infinite loops when they are followed by an event and "raise" behaviours if their event is local to a "trap" in which it is declared. See item 622 in the HISTORY.txt file.
loop body is executed at most onceor:
unreachable behaviour (dead code) after infinite loop and "break"for processes that contain "trap" behaviours. See item 623 in the HISTORY.txt file.
function F1 (Y : Nat) : Nat is var X : Nat in X := Z; -- no more warning: useless assignment to X F2 (?X, X); return X end var end functionbecause, in the call "F2 (?X, X)", X is necessarily read before written. Indeed, "in" and "in out" parameters are read before the call, while "out" and "in out" parameters are written after the call, in whatever order these arguments are passed to the called function. See item 611 in the HISTORY.txt file.
trap E: exit -> raise E' ...
trap E1: exit -> raise E'1 | E2: exit -> loop E'2 end loop ...
- process with "out" parameter(s) but looping infinitely - function F may return without assigning parameter X - process P may return without assigning parameter YSee item 624 in the HISTORY.txt file.
For many years, TRAIAN has been used to develop compilers, including those of the CADP toolbox.
At present, TRAIAN is also part of the CADP toolbox, in which it serves to analyze formal specifications of concurrent systems.
We plan to pursue the progressive unification of the LOTOS NT and LNT
languages, and to increase the co-operation between the LNT2LOTOS and TRAIAN
compilers.
TRAIAN 3.13 can be freely downloaded from the TRAIAN Web Page located at: