WIPIVERSE All articles

Lustre (programming language)

Lustre is a formally defined, declarative, and synchronous dataflow programming language designed for programming reactive systems, such as automatic control and monitoring applications, as well as for describing hardware. It is a well-established programming language with extensive documentation and industrial use.

History

Lustre began as a research project in the early 1980s, developed at the Verimag laboratory in Grenoble, France, by Nicolas Halbwachs, Paul Caspi, and their colleagues. A formal presentation of the language appeared in the 1991 Proceedings of the IEEE. In 1993, Lustre progressed to practical, industrial use as the core language of the commercial environment SCADE, developed by Esterel Technologies. It is used for critical control software in aircraft, helicopters, and nuclear power plants.

Paradigm

Lustre is based on the synchronous paradigm: the behavior of a program is a sequence of reactions, where each reaction consists of reading the current inputs, computing the current outputs, and updating the internal state. A program therefore implements an automaton in which the states are valuations of the memory and each reaction corresponds to a transition.

Lustre is a declarative language—a Lustre program is an unordered set of equations linking the variables of the program; these equations always hold during the execution of the program.

Structure of Lustre programs

A Lustre program consists of a series of node definitions. A node defines a computational unit with named inputs and outputs. A basic example:

node foo(a : bool) returns (b : bool);
let
  b = not a;
tel

Here, foo is the name of the node, a is an input, and b is the output. This node returns the negation of its input.

Internal variables can also be declared:

node Nand(X,Y: bool) returns (Z: bool);
  var U: bool;
let
  U = X and Y;
  Z = not U;
tel

Notably, the order of equations does not affect the result in Lustre.

Special operators

Lustre includes two distinctive special operators:

  • pre p — Returns the value of p in the previous cycle. It serves as a way to access the previous value of a variable (memory/state).
  • p -> q — Sets p as the initial value of the expression q. It is used to define the initial value of a stream.

Example applications

Lustre is commonly used to implement edge-detection logic in reactive systems:

Rising Edge detection:

node RisingEdge (X : bool) returns (E : bool);
let
  E = X and not pre X;
tel

Falling Edge detection:

node FallingEdge (X : bool) returns (E : bool);
let
  E = not X and pre X;
tel

Relation to other languages

Lustre is related to other synchronous or dataflow-oriented languages, including:

  • Esterel — a synchronous programming language for reactive systems.
  • SIGNAL — another dataflow-oriented synchronous language.

Lustre's lineage has also influenced the design of modern synchronous languages such as Lucid Synchrone and Zélus. The language continues to be studied in academia and used in safety-critical industrial domains.

Key sources

  • N. Halbwachs et al., "The Synchronous Data Flow Programming Language LUSTRE," Proceedings of the IEEE, Vol. 79, No. 9, 1991.
  • The Lustre V6 Reference Manual, Verimag, Grenoble.
  • Official pages of the Synchrone team at Verimag and the SCADE product documentation.
Browse

More topics to explore

    Browse all articles