跳转到内容

ALGOL W

维基百科,自由的百科全书
ALGOL W
编程范型多范型过程式, 指令式, 结构化
语言家族ALGOL
設計者Niklaus Wirth, Tony Hoare
发行时间1966年,​58年前​(1966
型態系統静态, 强类型
作用域词法
實作語言PL360
系统平台IBM System/360
啟發語言
ALGOL 60, ALGOL X英语ALGOL X
影響語言
Pascal, Modula-2

ALGOL W,一種程式語言,為ALGOL家族的一份子。它基於尼克勞斯·維爾特東尼·霍爾IFIP Working Group 2.1英语IFIP Working Group 2.1針對ALGOL X英语ALGOL X所提出的草案而設計,希望能作為ALGOL 60的後繼者[1]。經過小幅度的修改[2],在史丹福大學尼克勞斯·維爾特利用IBM System/360機器,以PL360實作出第一版的ALGOL W[3]

它的編譯器是用尼克勞斯·維爾特所設計的PL360組語所寫成[4]

例子

下面例子展示ALGOL W的记录类型设施:

RECORD PERSON (
    STRING(20) NAME; 
    INTEGER AGE; 
    LOGICAL MALE; 
    REFERENCE(PERSON) FATHER, MOTHER, YOUNGESTOFFSPRING, ELDERSIBLING
);

REFERENCE(PERSON) PROCEDURE YOUNGESTUNCLE (REFERENCE(PERSON) R);
BEGIN
    REFERENCE(PERSON) P, M;
    P := YOUNGESTOFFSPRING(FATHER(FATHER(R)));
    WHILE (P ¬= NULL) AND (¬ MALE(P)) OR (P = FATHER(R)) DO
        P := ELDERSIBLING(P);
    M := YOUNGESTOFFSPRING(MOTHER(MOTHER(R)));
    WHILE (M ¬= NULL) AND (¬ MALE(M)) DO
        M := ELDERSIBLING(M);
    IF P = NULL THEN 
        M 
    ELSE IF M = NULL THEN 
        P 
    ELSE 
        IF AGE(P) < AGE(M) THEN P ELSE M
END

引用

  1. ^ Niklaus Wirth & C. A. R Hoare (1966) A contribution to the development of ALGOL. Communications of the ACM, Vol.9, pp. 413–432
  2. ^ Niklaus Wirth (1966), Additional notes on "A Contribution to the Development of ALGOL", ALGOL Bulletin, Number 24 pp. 13 - 17.
  3. ^ Stanford Computer Science Department Technical Report CS-TR-68-89页面存档备份,存于互联网档案馆) (Various documents for Stanford University's 1972 implementation of ALGOL W; this report includes the ALGOL W Language Description.)
  4. ^ PL360(REVISED) A PROGRAMMING LANGUAGE FOR THE IBM 360. (PDF). [2020-05-16]. (原始内容存档 (PDF)于2016-03-04). 

外部链接