ALGOL 60
ALGOL 60(源自ALGOrithmic Language 1960的縮寫),是一種程式語言。它是ALGOL語言家族中的成員之一,以ALGOL 58为基礎,在1960年創建,其官方後繼者是ALGOL 68。Algol 60引进了许多新的概念如:块结构、词法作用域、递归、巴科斯-诺尔范式(BNF)等等,它在程式語言设计和发展演化中有著很大的影響力。
歷史
1960年1月,艾伦·佩利在巴黎举行的有全世界一流软件专家参加的讨论会上,发表了《算法语言Algol 60报告》[1],确定了程序设计语言Algol 60。艾兹赫尔·戴克斯特拉实现了Algol60语言的第一个编译器。1962年,艾伦·佩利又对Algol 60进行了修订[2]。
Algol 60是程序设计语言发展史上的一个里程碑,影響到其後的Simula、CPL、ALGOL W、BCPL、B、Pascal、C等。它标志着程序设计语言成为一门独立的科学学科,并为后来软件自动化及软件可靠性的发展奠定了基础。
標準
ALGOL 60以及COBOL,是第一個企圖標準化的程式語言。ALGOL60曾經提出兩項ISO標準,但現在都已經撤消:
性质
ALGOL 60在官方定义上没有I/O设施;诸多实现以少有相互兼容的方式定义了自己设施。
ALGOL 60为参数传递提供了两种求值策略:共通的传名调用,和传值调用。过程声明为每个形式参数指定使用其中哪一个:value
指定传值调用,缺省则为传名调用。对比于传引用调用,传名调用有特殊效果。例如,不指定参数为value
或reference
,就不可能开发出交换两个参数的值的过程,存在着传递进来的实际参数是一个整数变量和以同一个整数变量为索引的数组的情况[5]。
传名调用由于用来实现它的有趣的thunk,而被很多编译器设计者熟知。Donald Knuth设计了“男人或男孩测试”,来区分编译器是否正确的实现了“递归和非局部引用”。这个测试包含传名调用的例子。
保留字和限制标识符
在标准Burroughs大型系统子语言中有35个保留字:
|
|
|
|
|
在标准Burroughs大型系统子语言中有71个限制标识符:
|
|
|
|
|
和所有固有函数的名字。
标准运算符
优先级 | 运算符 | |
---|---|---|
第一 算术 | 第一 | ↑(幂) |
第二 | ×,/(实数),÷(整数) | |
第三 | +,- | |
第二 | <,≤,=,≥,>,≠ | |
第三 | ¬(非) | |
第四 | ∧(与) | |
第五 | ∨(或) | |
第六 | ⊃(蕴涵) | |
第七 | ≡(等价) |
例子
下面是语言报告中过程声明的例子:
procedure Absmax(a) Size:(n, m) Result:(y) Subscripts:(i, k); value n, m; array a; integer n, m, i, k; real y; comment 矩阵a,大小为n乘m,它的绝对值最大的元素 被传送到y,并且这个元素的下标是i和k; begin integer p, q; y := 0; i := k := 1; for p := 1 step 1 until n do for q := 1 step 1 until m do if abs(a[p, q]) > y then begin y := abs(a[p, q]); i := p; k := q end end Absmax
这里的关键字写法依赖于实现,比如将integer
加引号写为'INTEGER'
,这叫做索绕(stropping)。
实现时间线
迄今Algol 60已经有了至少70个扩充、扩展、派生和子语言[6]。
名字 | 年份 | 作者 | 国家 | 描述 | 目标CPU |
---|---|---|---|---|---|
X1 ALGOL 60 | 1960年8月[7] | Edsger W. Dijkstra和Jaap A. Zonneveld | 荷兰 | 第一个ALGOL 60实现[8] | Electrologica X1 |
Algol | 1960[9] | Edgar T. Irons | 美国 | Algol 60 | CDC 1604 |
Burroughs Algol(及一些变体) | 1961 | Burroughs公司(有Hoare、Dijkstra和其他人参与) | 美国 | 以Burroughs(后来基于Unisys MCP)计算机为基础。Burroughs方言包括了特殊系统编程方言比如ESPOL和NEWP。 | Burroughs大型系统和中型系统。 |
Case ALGOL | 1961 | 美国 | Simula最初签约为Case ALGOL的模拟器扩展 | UNIVAC 1107 | |
GOGOL | 1961 | William M. McKeeman | 美国 | 用于ODIN分时系统 | PDP-1 |
DASK ALGOL | 1961 | Peter Naur,Jørn Jensen | 丹麦 | Algol 60 | Regnecentralen的DASK |
SMIL ALGOL | 1962 | Torgil Ekman,Carl-Erik Fröberg | 瑞典 | Algol 60 | 隆德大学的SMIL |
GIER ALGOL | 1962 | Peter Naur,Jørn Jensen | 丹麦 | Algol 60 | Regnecentralen的GIER |
Dartmouth ALGOL 30[10] | 1962 | Thomas Eugene Kurtz,Stephen J. Garland,Robert F. Hargraves,Anthony W. Knapp,Jorge LLacer | 美国 | Algol 60 | LGP-30 |
Alcor Mainz 2002 | 1962 | Ursula Hill-Samelson,Hans Langmaack | 德国 | Siemens 2002 | |
ALCOR-ILLINOIS 7090 | 1962[11][12] | Manfred Paul,Hans Rüdiger Wiehle,David Gries,Rudolf Bayer | 美国,西德 | Algol 60,伊利诺伊大学和慕尼黑工业大学的实现,1962年-1964年 | IBM 7090 |
USS 90 Algol | 1962 | L. Petrone | 意大利 | ||
Elliott ALGOL | 1962 | C. A. R. Hoare | 英国 | 在他的1980年图灵奖演讲中讨论 | Elliott 803 & Elliott 503 |
Algol 60 | 1962 | Roland Strobel[13] | 东德 | 由柏林德国科学院应用数学研究所实现 | Zeiss-Rechenautomat ZRA 1 |
Algol Translator | 1962 | G. van der Mey,W.L. van der Poel | 荷兰 | Staatsbedrijf der Posterijen,Telegrafie en Telefonie | ZEBRA |
Kidsgrove Algol | 1963 | F. G. Duncan | 英国 | 英国电气公司KDF9 | |
SCALP[14] | 1963 | Stephen J. Garland,Anthony W. Knapp,Thomas Eugene Kurtz | 美国 | 作为Algol 60子集的自齐备Algol处理器 | LGP-30 |
VALGOL | 1963 | Val Schorre | 美国 | META II编译器的编译器的测试品 | |
FP6000 Algol | 1963 | Roger Moore | 加拿大 | 为Saskatchewan电力公司写作 | FP6000 |
Whetstone | 1964 | Brian Randell,Lawford John Russell | 英国 | 英国电气公司原子能部。以Ferranti Pegasus为前提,国家物理实验室ACE和English Electric DEUCE实现。 | 英国电气公司KDF9 |
ALGOL 60 | 1964 | Jean-Claude Boussard[15] | 法国 | Institut d'informatique et mathématiques appliquées de Grenoble | IBM 7090 |
ALGOL 60 | 1965 | Claude Pair[16] | 法国 | Centre de calcul de la Faculté des Sciences de Nancy | IBM 1620 |
Dartmouth ALGOL | 1965 | Stephen J. Garland,Sarr Blumson,Ron Martin | 美国 | Algol 60 | 用于GE 235的Dartmouth分时系统 |
NU ALGOL | 1965 | 挪威 | UNIVAC | ||
Algol 60 | 1965[17] | F.E.J. Kruseman Aretz | 荷兰 | 用于EL-X8的MC编译器 | Electrologica X8 |
ALGEK | 1965 | 苏联 | АЛГЭК,基于ALGOL-60并支持COBOL,用于经济任务 | Minsk-22 | |
MALGOL | 1966 | publ. A. Viil,M Kotli,M. Rakhendi | 爱沙尼亚 | Minsk-22 | |
ALGAMS | 1967 | GAMS组织(ГАМС,группа автоматизации программирования для машин среднего класса),协作于Comecon科学院 | 经济互助委员会 | Minsk-22,后来的ES EVM,BESM | |
ALGOL/ZAM | 1967 | 波兰 | 波兰ZAM计算机 | ||
Chinese Algol[18] | 1972 | 中国 | 中文,通过SYMBOL系统表达 | ||
DG/L | 1972 | 美国 | DG Eclipse计算机家族 | ||
NASE[19] | 1990 | Erik Schoenfelder | 德国 | 解释器 | Linux和MS Windows |
MARST[20] | 2000 | Andrew Makhorin | 俄国 | Algol-60到C转换器 | GNU编译器套件支持的全部CPU;MARST是GNU计划成员 |
参见
引用
- ^ Backus, J. W.; Bauer, F. L.; Green, J.; Katz, C.; McCarthy, J.; Perlis, A. J.; Rutishauser, H.; Samelson, K.; Vauquois, B.; Wegstein, J. H.; van Wijngaarden, A.; Woodger, M. Naur, Peter , 编. Report on the Algorithmic Language ALGOL 60. Communications of the ACM (Copenhagen). May 1960, 3 (5): 299–314. ISSN 0001-0782. S2CID 278290. doi:10.1145/367236.367262.
- ^ . 1963 [2020-04-23]. (原始内容存档于2007-06-25).
- ^ (PDF). [2022-05-02]. (原始内容 (PDF)存档于2021-01-31).
- ^ . [2022-05-02]. (原始内容存档于2022-05-02).
- ^ Alfred V. Aho, Ravi Sethi, Jeffrey D. Ullman. Compilers: Principles, Techniques, and Tools 1st. Addison-Wesley. 1986. ISBN 978-0-201-10194-2., Section 7.5, and references therein
- ^ The Encyclopedia of Computer Languages 互联网档案馆的,存档日期September 27, 2011,.
- ^ Daylight, E. G. . The Computer Journal. 2011, 54 (11): 1756–1772 [2022-05-02]. doi:10.1093/comjnl/bxr002. (原始内容存档于2013-03-12).
- ^ Kruseman Aretz, F.E.J. (PDF). Software Engineering. History of Computer Science. Kruislaan 413, 1098 SJ Amsterdam: Centrum Wiskunde & Informatica. 30 June 2003 [2022-05-02]. (原始内容 (PDF)存档于2021-10-23).
- ^ Edgar T. Irons, A syntax directed compiler for ALGOL 60, Communications of the ACM, Vol. 4, p. 51. (Jan. 1961)
- ^ Thomas E. Kurtz, "Basic" (页面存档备份,存于互联网档案馆), History of Programming Languages, Association for Computing Machinery, June 1978, page 516.
- ^ Gries, D.; Paul, M.; Wiehle, H. R. Some techniques used in the ALCOR ILLINOIS 7090. Communications of the ACM. 1965, 8 (8): 496–500. S2CID 18365024. doi:10.1145/365474.365511.
- ^ Bayer, R.; Gries, D.; Paul, M.; Wiehle, H. R. The ALCOR Illinois 7090/7094 post mortem dump. Communications of the ACM. 1967, 10 (12): 804–808. S2CID 3783605. doi:10.1145/363848.363866.
- ^ Rechenautomaten mit Trommelspeicher (页面存档备份,存于互联网档案馆), Förderverein der Technischen Sammlung Dresden
- ^ Kurtz, op. cit., page 517.
- ^ Jean-Claude Boussard. (学位论文). Institut d'informatique et mathématiques appliquées de Grenoble: Université Joseph-Fourier - Grenoble I. June 1964 [2022-05-02]. (原始内容存档于2022-04-10).
- ^ Claude Pair. Description d'un compilateur ALGOL. European Région 1620 Users Group (IBM). 27 April 1965.
- ^ Kruseman Aretz, F.E.J. An Algol 60 compiler in Algol 60. Mathematical Centre Tracts. Amsterdam: Mathematisch Centrum. 1973.
- ^
- ^ . [2022-05-02]. (原始内容存档于2022-03-30).
- ^ . [2020-04-23]. (原始内容存档于2020-03-22).
外部链接
- Revised Report on the Algorithmic Language Algol 60 (页面存档备份,存于互联网档案馆) by Peter Naur, et al. ALGOL definition
- A BNF syntax summary (页面存档备份,存于互联网档案馆) of ALGOL 60
- – Hoare's 1980 ACM Turing Award speech, which discusses ALGOL history and his involvement
- MARST (页面存档备份,存于互联网档案馆), a free Algol-to-C translator
- An Implementation of ALGOL 60 for the FP6000 (页面存档备份,存于互联网档案馆) Discussion of some implementation issues.
- Naur, Peter. The European Side of the Last Phase of the Development of ALGOL 60. ACM SIGPLAN Notices. August 1978, 13 (8): 15–44. S2CID 15552479. doi:10.1145/960118.808370.
- Edinburgh University wrote compilers for Algol60 (later updated for Algol60M) based on their Atlas Autocode compilers initially bootstrapped from the Atlas to the KDF-9. The Edinburgh compilers generated code for the ICL1900, the ICL4/75 (an IBM360 clone), and the ICL2900. Here is the BNF for Algol60 互联网档案馆的,存档日期2020-05-15. and the ICL2900 compiler source 互联网档案馆的,存档日期2020-05-15., library documentation 互联网档案馆的,存档日期2020-05-15., and a considerable test suite 互联网档案馆的,存档日期2020-05-15. including Brian Wichmann's tests. 互联网档案馆的,存档日期2020-05-15. Also there is a rather superficial Algol60 to Atlas Autocode source-level translator 互联网档案馆的,存档日期2020-05-15..
- Eric S. Raymond's Retrocomputing Museum (页面存档备份,存于互联网档案馆), among others a link to the NASE Algol-60 interpreter written in C.
- The NASE interpreter (页面存档备份,存于互联网档案馆)
- Stories of the B5000 and People Who Were There: a dedicated ALGOL computer [1] (页面存档备份,存于互联网档案馆), [2] (页面存档备份,存于互联网档案馆)
- Hermann Bottenbruch. . 1961 [2021-04-10]. doi:10.2172/4020495. (原始内容存档于2021-04-24).
- NUMAL (页面存档备份,存于互联网档案馆) A Library of Numerical Procedures in ALGOL 60 developed at The Stichting Centrum Wiskunde & Informatica (legal successor of Stichting Mathematisch Centrum) .
- Algol 60 resources: translators, documentation, programs (页面存档备份,存于互联网档案馆)
- Algol-60 (页面存档备份,存于互联网档案馆) included in Racket.