Lustre (programming language)
Programming language
- 1 min read
- 2 chapters
Related on Lably
Through Airbus
Structure of Lustre programs
A Lustre program is a series of node definitions, written as:
<span id="mwIA"></span>node foo(a : bool) returns (b : bool); let b = not a; tel
Where foo is the name of the node, a is the name of the single input of this node and b is the name of the single output. In this example the node foo returns the negation of its input a, which is the expected result.
Inner variables
Additional internal variables can be declared as follows:
<span id="mwKw"></span>node Nand(X,Y: bool) returns (Z: bool); var U: bool; let U = X and Y; Z = not U; tel
Note: The equations order doesn't matter, the order of lines U = X and Y; and Z = not U; doesn't change the result.
Special operators
Sign in to keep reading
One more chapter is free with a Lably account.
Examples
Rising Edge detection
<span id="mwRQ"></span>node RisingEdge (X : bool) returns (E : bool); let E = X and not pre X; tel
Falling Edge detection
<span id="mwSQ"></span>node FallingEdge (X : bool) returns (E : bool); let E = not X and pre X; tel

