跳至內容

Lustre語言

本頁使用了標題或全文手工轉換
維基百科,自由的百科全書
Lustre
編程範型資料流程, 同步式
設計者J.L.Bergerand, P.Caspi, N.Halbwachs, J.A.Plaice.
實作者愛斯特爾技術公司英語Esterel Technologies
面市時間1985年,​39年前​(1985
許可證專有軟體
主要實作產品
SCADE的核心語言
啟發語言
Lucid
影響語言
Lucid Synchrone

Lustre形式化定義的、聲明式同步式資料流程編程語言,用於回應式系統編程。它在1980年代前期成為了研究專案,受到過Lucid語言的影響[1]。這個語言的形式表述可以在1991年的《Proceedings of the IEEE》找到[2]。在1993年,它發展進入實際的商業和工業使用,成為一個商業產品,它是愛斯特爾技術公司英語Esterel Technologies開發的工業環境SCADE的核心語言。它被用於在空中巴士[3]空客直升機核電廠的關鍵控制軟體中。

Lustre程式的結構[編輯]

Lustre程式是一系列的「節點」定義,寫為:

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

這裡的foo是節點的名字,a是這個節點的單一輸入的名字,而b是單一輸出的名字。在這個例子中,節點foo返回對它的輸入a的否定,這是於預期的結果。

內在變數[編輯]

額外的內部變數可以聲明如下:

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

注意:等式的次序並不重要,行U = X and Y;Z = not U;的次序不改變結果。

特殊算子[編輯]

pre p 返回p以前的值
p -> q 設定p為表達式q的初始值

例子[編輯]

邊緣檢測[編輯]

node Edge (X : bool) returns (E : bool);
let
  E = false -> X and not pre X;
tel

參見[編輯]

參照[編輯]

  1. ^ Automatic control systems programming using a real-time declarative language. J.L.Bergerand, P.Caspi, N.Halbwachs, J.A.Plaice. IFAC Proceedings Volumes Volume 19, Issue 6, May 1986, Pages 89-93.
  2. ^ The Synchronous Data Flow Programming Language LUSTRE[失效連結]. N. Halbwachs et al. In Proc. IEEE 1991 Vol. 79, No. 9. Accessed 17 March 2014.
  3. ^ SCADE Success Stories. [8 June 2013]. (原始內容存檔於2019-01-30). 

外部連結[編輯]