The CONVECS team is pleased to announce
that version 3.10 of the TRAIAN compiler for LOTOS NT is available.
With TRAIAN 3.10, the convergence between LOTOS NT and LNT is nearly complete. Measured on a test suite of 13,500+ correct LNT programs totalling more than 9 million non-blank lines of LNT code, TRAIAN 3.10 syntactically accepts 100% of these programs and semantically accepts 93.5% of them (whereas TRAIAN 3.9 accepted 89.3% of them).
TRAIAN 3.10 brings seven language changes, six compiler changes, four code-generation changes, six library changes, two release changes, and thirteen bug fixes (see below their description).
type T is list of Nat with == !implementedby "EQ_T", NIL !implementedby "NIL_T", CONS !implementedby "CONS_T" end typeFormerly, such definitions were rejected by TRAIAN 3.9 with the following error messages:
error: unknown function NIL in "with" clause of type T error: unknown function CONS in "with" clause of type TSee item 493 in the HISTORY.txt file.
This change has minor side effects. For instance, the pattern:
X * any T + Ywhich was formally rejected with a syntax error, is now syntactically accepted and parsed as follows:
(X * any) T (+ Y)possibly followed by an error if function T is undefined. Similarly, the pattern:
X as any T + Ywhich was formally rejected, is now syntactically correct. See item 495 in the HISTORY.txt file.
type T is A, B, C with > !external !implementedby "C:GT" end typewas formerly rejected with an error message:
error: unexpected pragma !external for predefined operation >From now on, this type definition is accepted. TRAIAN does not generate any C code for the external function, but inserts a C comment stating that the user should provide an implementation for this function in the ".fnt" file.
Also, if the !external pragma does not come together with an !implementedby pragma, e.g.:
type T is A, B, C with > !external end typeTRAIAN now emits the following warning:
warning: missing pragma !implementedby "C:..." for external function >The TRAIAN Reference Manual was updated accordingly. See item 510 in the HISTORY.txt file.
type T is !external !implementedby "T" with ==, != end typewas formerly rejected with the following error message:
error: unexpected "with" clause for external type TFrom now on, it is accepted, under the following rules:
warning: redundant pragma !external for function ==
warning: missing pragma !implemented for function ==
From now on, it is permitted to add, in the definition of any type T (external or not), a "with" clause that defines some function F, already listed in the "with" clause of the module, with an !implementedby pragma attached to F. For instance, the following module definition:
module M with == is ... type T is set of Bool with == !implementedby "EQ_T", != !implementedby "NE_T" end type ... end modulewhich formerly triggered a warning:
warning: redundant clause "with ==" for type T (already present for the module)is now accepted without warning if the "with ==" clause comes with pragmas, among which an !implementedby pragma must be present.
Also, if the type T is external and contains no "with" clause for the function "==", e.g.:
module M with == is ... type T is !external !implementedby "T" with != !implementedby "NE_T" end type ... end modulea new warning will be emitted by TRAIAN:
warning: missing clause: with == !implementedby "C:..."See item 512 in the HISTORY.txt file.
type T is !external list of int end typeLOTOS NT and TRAIAN have been modified to forbid as well attaching !external pragmas to arrays, ranges, sets, sorted lists, and predicate types. In such cases, TRAIAN now emits new error messages:
error: unexpected pragma !external for array type T error: unexpected pragma !external for range type T error: unexpected pragma !external for set type T error: unexpected pragma !external for sorted list type T error: unexpected pragma !external for where type TSee item 514 in the HISTORY.txt file.
PRINT (?true)TRAIAN no longer displays this warning:
warning: useless "?" symbol before 1st offer (no variable present)but the following, simpler one:
warning: useless "?" symbol before offer (no variable present)See item 482 in the HISTORY.txt file.
0, CONS ('a', NIL), any where X > 0now triggers the following message:
warning: unexpected "where" in 3rd pattern (no variable before this condition)Similarly, the following statement:
case X in 0 -> return FALSE | any where X > 10 -> return TRUE | any -> return FALSE end casenow triggers the following message:
warning: unexpected "where" in pattern (no variable before this condition)and should be rewritten as follows:
case X in 0 -> return FALSE | any -> return X > 10 end caseSee item 483 in the HISTORY.txt file.
warning: useless clause "with F" in module M
The consequences of these changes are not yet visible to end users (since most scheme functions have a "null" body at the moment) but will become manifest in future releases of TRAIAN. See item 492 in the HISTORY.txt file.
module M with == is type T is !external !implementedby "T" end type end modulewould generate a message:
warning: useless clause "with ==" in module MThis message is no longer emitted because the "with" clause now applies to type T, defining a function ==: T, T -> BOOL. From now on, the warning will only be emitted for modules that do not contain any type definition. See item 513 in the HISTORY.txt file.
#include "FILE_t.h" #include "FILE_f.h"with:
#include "FILE.c"The "traian_delete" command and the TRAIAN demo examples have been updated accordingly. See item 502 in the HISTORY.txt file.
Formerly, these functions relied on the POSIX functions strtoul() and strtol(), which only support C constants, but not all features of LOTOS NT natural and integer constants. Moreover, only the valid prefix of the string was checked, meaning that inputs of the form "10A", were accepted and recognized as 10. Leading and trailing spaces are accepted and eliminated.
The new implementations support binary constants (starting with "0b"), octal constants (starting with "0o"), hexadecimal constants (starting with "0x"), as well as the presence of underscores in number notations. They also forbid useless initial zeros (e.g., "007") and check the entire input string (rather than a prefix). An exception is raised if the input is incorrect.
For instance, the following sequence of actions:
PRINT (NAT (" 1_0 ")); PRINT (NAT ("10_345")); PRINT (NAT ("0b1001_00_1")); PRINT (NAT ("0o1701_20_345")); PRINT (NAT ("0xAB_CD"))now produces the following output:
"PRINT !10" "PRINT !10345" "PRINT !73" "PRINT !31498469" "PRINT !43981"whereas, formerly, it was generating:
"PRINT !1" "PRINT !10" "PRINT !0" "PRINT !0" "PRINT !0"See item 499 in the HISTORY.txt file.
PRINT (REAL (" 1_0.0_0_0_1 ")); PRINT (REAL (" -1_0.1")); PRINT (REAL ("+1_0E01_1 "))now produces the following output:
"PRINT !10.0001" "PRINT !-10.1" "PRINT !1e+12"whereas, formerly, it was generating:
"PRINT !1" "PRINT !-1" "PRINT !1"See item 500 in the HISTORY.txt file.
The code generation part of TRAIAN was updated to take these changes into account. See item 507 in the HISTORY.txt file.
_exception_loc -> TRAIAN_LIB_EVENT_STRUCT NONE_EXCEPTION_DATA -> TRAIAN_LIB_NO_DATA TRAIAN_ADTI_EXCEPTION -> TRAIAN_LIB_EVENT TRAIAN_ADTI_do_raise_exception() -> TRAIAN_LIB_EVENT_RAISING() TRAIAN_ADTI_exception_endtrap() -> TRAIAN_LIB_TRAP_LEAVE() TRAIAN_ADTI_exception_trap() -> TRAIAN_LIB_TRAP_ENTRY() TRAIAN_ADTI_free_exception() -> TRAIAN_LIB_EVENT_DELETE() TRAIAN_ADTI_init_exceptions() -> TRAIAN_LIB_EVENT_INIT() TRAIAN_ADTI_KIND_* -> TRAIAN_LIB_KIND_* TRAIAN_ADTI_new_exception() -> TRAIAN_LIB_EVENT_CREATE() TRAIAN_ADTI_not_reached() -> TRAIAN_LIB_UNREACHEABLE() TRAIAN_ADTI_exception_get_data() -> TRAIAN_LIB_EXCEPTION_DATA() TRAIAN_ADTI_raise_event() -> TRAIAN_LIB_EVENT_RAISE() TRAIAN_ADTI_raise_exception() -> TRAIAN_LIB_EVENT_TRIGGER() TRAIAN_ADTI_TRAP_ERROR -> TRAIAN_LIB_TRAP_DUMP TRAIAN_ADTx_RANGE_ERROR -> TRAIAN_LIB_NO_EVENT TRAIAN_LIB_TRAP_ENTRY() -> TRAIAN_LIB_TRAP_ENTERING()The C code generated by TRAIAN was updated accordingly. See item 508 in the HISTORY.txt file.
"@(#)TRAIAN -- 1.4 -- 2023/02/28 10:57:21 -- scheme_list.lnt"See item 486 in the HISTORY.txt file.
See item 501 in the HISTORY.txt file.
module M with subset is ... type T is list of ... end type ... end modulebecause "subset" is not a predefined function defined over lists. From now on, no "subset" function is created for type T. See item 481 in the HISTORY.txt file.
type T is !implementedby "T" C (X, Y: INT) with == !implementedby "EQ", != !implementedby "NE" end typeTRAIAN generated two comparison functions named, respectively, TRAIAN_EQ_T() and TRAIAN_NE_T() instead of EQ() and NE(). See item 487 in the HISTORY.txt file.
type T is array [1..2] of NAT end type var A: Tthe following code fragments triggered improper warnings:
1) A := T (0, 0); -- here, warning: useless assignment to A A [0] := 1; use A 2) A := T (0, 0); -- here, warning: useless assignment to A A [0] := 1; -- here, warning: useless assignment to A A [1] := 1; use A 3) A := T (0, 0); -- here, warning: useless assignment to A if X then A := T (1, 1) -- here, warning: useless assignment to A end if; A [0] := 1; use A 4) A := T (0); -- here, warning: useless assignment to A if X then A := T (1, 1) -- here, warning: useless assignment to A end if; A [0] := 1; use AThis issue has been solved by better distinguishing between "total" assignments (to all the elements of an array) and "partial" assignments (to one particular element of an array). See item 488 in the HISTORY.txt file.
error: array X may be (partially) uninitializedSee item 489 in the HISTORY.txt file.
warning: possibly incomplete patterns in "case" instruction some values of type Int might not be matched by the given constants (an "any" pattern might be necessary to match the missing cases)This issue is now solved and these warnings are emitted. See item 494 in the HISTORY.txt file.
type T is A, B, C with STRING !implementedby "S" end typethe C function generated for STRING was not named S(), but TRAIAN_STRING_T(). See item 497 in the HISTORY.txt file.
type T is nil, cons (h: Bool, t: T) with >= !implementedby "GE" end typethe C function generated for >= was named TRAIAN_GE_T() instead of GE(). See item 498 in the HISTORY.txt file.
FILE.lnt:0: error: type T is not definedor:
FILE.lnt:38866: error: type T is not definedAfter fixing the bug, the error message becomes:
FILE.lnt:16777217: error: type T is not definedSee item 504 in the HISTORY.txt file.
function F (X : BOOL) is return G (*** -> 0) end functionThe grammar was made stricter and the above example is now rejected. See item 516 in the HISTORY.txt file.
For many years, TRAIAN has been used to develop compilers, including those of the CADP toolbox. At present, it is also intensively used to check LNT specifications of concurrent systems, allowing to catch mistakes not detected by the "lightweight" approach of the LNT2LOTOS translator.
TRAIAN will continue to evolve, our goal being to merge LOTOS NT and LNT
in one single language.
TRAIAN 3.10 can be freely downloaded from the TRAIAN Web Page located at: