ALGOL 60

ALGOL 60
编程范型指令式过程式结构化
语言家族ALGOL
設計者Bauer英语Friedrich L. Bauer, Rutishauser英语Heinz Rutishauser, Samelson英语Klaus Samelson, 巴科斯, Katz英语Charles Katz, 佩利, Wegstein英语Joseph Henry Wegstein, 諾爾, Vauquois英语Bernard Vauquois, 范·韦恩加登, Woodger英语Michael Woodger, J. Green, 麦卡锡
发行时间1960年,​64年前​(1960
当前版本
  • ISO 1538:1984(1984年10月15日)[1]
編輯維基數據鏈接
型態系統静态, 强类型
作用域词法
啟發語言
ALGOL 58
影響語言
ALGOL 68, 所有“类似ALGOL语言”比如: Simula, Pascal, C等, ISWIM, Scheme

ALGOL 60(源自ALGOrithmic Language 1960的縮寫),是在1960年創建的称为“算法语言”的一種程式語言。它是以后来称为ALGOL 58的“国际代数语言”为基礎,其官方後繼者是ALGOL 68,它们一起并称为ALGOL語言家族。Algol 60引进了许多新的概念如:词法作用域递归[2]巴科斯-诺尔范式(BNF),它在程式語言设计和发展演化中有著巨大的影響力。

歷史

[编辑]

1960年,在巴黎举行的讨论会上,来自欧洲的诺尔Bauer英语Friedrich L. BauerRutishauser英语Heinz RutishauserSamelson英语Klaus Samelson范·韦恩加登Vauquois英语Bernard VauquoisWoodger英语Michael Woodger,与来自美国的佩利巴科斯麦卡锡Katz英语Charles KatzWegstein英语Joseph Henry Wegstein和J. Green,共同发表了《算法语言ALGOL 60报告》[3]戴克斯特拉实现了ALGOL 60语言的第一个编译器。在1962年罗马会议上,ALGOL 60报告得到了修订,并于1963年出版[4]

ALGOL 60是程序设计语言发展史上的一个里程碑,影響到其後的SimulaCPLALGOL WISWIMBCPLBPascalCScheme等。它标志着程序设计语言成为一门独立的科学学科,并为后来软件自动化及软件可靠性的发展奠定了基础。

標準

[编辑]

ALGOL 60以及COBOL,是最初的企圖標準化的程式語言。ALGOL60曾經提出兩項ISO標準:

  • ISO 1538: 1984年,编程语言ALGOL 60[5],它已稳固化。
  • ISO 1672: 1977年,ALGOL基本符号的ISO 7位编码字符集硬件表示[6],它已撤消。

实现时间线

[编辑]

ALGOL 60在语言报告中没有I/O设施;诸多实现以少有相互兼容的方式定义了自己的设施。迄今ALGOL 60已经有了至少70个扩充、扩展、派生和子语言[7]

名字 年份 作者 国家 描述 目标CPU
X1 ALGOL 60 1960年8月[8] Edsger W. Dijkstra和Jaap A. Zonneveld  荷蘭 第一个ALGOL 60实现[9] Electrologica X1英语Electrologica X1
ALGOL 1960[10] Edgar T. Irons  美国 ALGOL 60 CDC 1604英语CDC 1604
Burroughs ALGOL英语Burroughs large systems#ALGOL(及一些变体) 1961 Burroughs公司英语Burroughs Corporation(有HoareDijkstra和其他人参与)  美国 以Burroughs(后来基于Unisys MCP英语Burroughs MCP)计算机为基础。Burroughs方言包括了特殊系统编程方言比如ESPOL英语Executive Systems Problem Oriented LanguageNEWP英语NEWP Burroughs大型系统英语Burroughs large systems中型系统英语Burroughs Medium Systems
Case ALGOL 1961  美国 Simula最初签约为Case ALGOL的模拟器扩展 UNIVAC 1107英语UNIVAC 1100/2200 series
GOGOL 1961 William M. McKeeman  美国 用于ODIN分时系统 PDP-1
DASK ALGOL 1961 Peter NaurJørn Jensen英语Jørn Jensen  丹麦 ALGOL 60 Regnecentralen英语RegnecentralenDASK英语DASK
SMIL ALGOL 1962 Torgil Ekman,Carl-Erik Fröberg  瑞典 ALGOL 60 隆德大学SMIL英语SMIL (computer)
GIER ALGOL 1962 Peter NaurJørn Jensen英语Jørn Jensen  丹麦 ALGOL 60 Regnecentralen英语Regnecentralen的GIER
Dartmouth ALGOL 30英语Dartmouth ALGOL 30[11] 1962 Thomas Eugene Kurtz英语Thomas Eugene Kurtz,Stephen J. Garland,Robert F. Hargraves,Anthony W. Knapp英语Anthony W. Knapp,Jorge LLacer  美国 ALGOL 60 LGP-30英语LGP-30
Alcor Mainz 2002 1962 Ursula Hill-Samelson,Hans Langmaack  德国 Siemens 2002
ALCOR-ILLINOIS 7090 1962[12][13] Manfred Paul,Hans Rüdiger Wiehle,David Gries英语David GriesRudolf Bayer  美国 西德 ALGOL 60,伊利诺伊大学慕尼黑工业大学的实现,1962年-1964年 IBM 7090
USS 90 ALGOL 1962 L. Petrone  義大利
Elliott ALGOL英语Elliott ALGOL 1962 C. A. R. Hoare  英国 在他的1980年图灵奖演讲中讨论 Elliott 803英语Elliott 803 & Elliott 503英语Elliott 503
ALGOL 60 1962 Roland Strobel[14]  东德 柏林德国科学院英语German Academy of Sciences at Berlin应用数学研究所实现 Zeiss-Rechenautomat ZRA 1
ALGOL 60 1962 Bernard Vauquois英语Bernard Vauquois,Louis Bolliet[15]  法國 格勒诺布尔计算机科学与应用数学研究所(IMAG)和Bull机器公司 Bull Gamma 60英语Bull Gamma 60
ALGOL Translator 1962 G. van der Mey,W.L. van der Poel英语Willem van der Poel  荷蘭 荷兰国家邮政局,电报电话 ZEBRA英语ZEBRA (computer)
Kidsgrove ALGOL 1963 F. G. Duncan  英国 英国电气公司英语English ElectricKDF9英语English Electric KDF9
SCALP[16] 1963 Stephen J. Garland,Anthony W. Knapp英语Anthony W. KnappThomas Eugene Kurtz英语Thomas Eugene Kurtz  美国 作为ALGOL 60子集的自齐备Algol处理器 LGP-30英语LGP-30
VALGOL 1963 Val Schorre  美国 META II英语META II编译器的编译器的测试品
FP6000 ALGOL 1963 Roger Moore英语Roger Moore (computer scientist)  加拿大 Saskatchewan电力公司英语SaskPower写作 FP6000英语Ferranti-Packard 6000
Whetstone英语Whetstone (benchmark) 1964[17] Brian Randell英语Brian Randell,Lawford John Russell  英国 英国电气公司原子能部。以Ferranti Pegasus英语Ferranti Pegasus为前提,国家物理实验室ACEEnglish Electric DEUCE英语English Electric DEUCE实现。 英国电气公司KDF9英语English Electric KDF9
ALGOL 60 1964 Jean-Claude Boussard[18]  法國 格勒诺布尔信息与数学应用研究所 IBM 7090
ALGOL-GENIUS 1964 Börje Langefors  瑞典 增加受COBOL启发的数据记录和I/O Datasaab英语Datasaab D-21
ALGOL 60 1965 Claude Pair[19]  法國 南锡科学学院计算中心 IBM 1620英语IBM 1620
Dartmouth ALGOL 1965 Stephen J. Garland,Sarr Blumson,Ron Martin  美国 ALGOL 60 用于GE 235英语GE-200 seriesDartmouth分时系统英语Dartmouth Time Sharing System
NU ALGOL 1965  挪威 UNIVAC
ALGOL 60 1965[20] F.E.J. Kruseman Aretz  荷蘭 用于EL-X8的MC编译器 Electrologica X8英语Electrologica X8
ALGEK 1965  苏联 АЛГЭК,基于ALGOL-60并支持COBOL,用于经济任务 Minsk-22英语Minsk family of computers
MALGOL 1966 publ. A. Viil,M Kotli,M. Rakhendi 爱沙尼亚苏维埃社会主义共和国 爱沙尼亚SSR Minsk-22英语Minsk family of computers
DJS-6 ALGOL 1966  中國 华北计算所 DJS-6
ALGAMS 1967 GAMS组织(ГАМС,中型机器自动化编程小组),协作于Comecon科学院 经济互助委员会 Minsk-22英语Minsk family of computers,后来的ES EVM英语ES EVMBESM英语BESM
ALGOL/ZAM 1967  波蘭 波兰ZAM计算机
DG/L英语DG/L 1972  美国 DG Eclipse英语Data General Eclipse计算机家族
NASE[21] 1990 Erik Schoenfelder  德国 解释器 Linux和MS Windows
MARST[22] 2000 Andrew Makhorin  俄羅斯 ALGOL 60到C转换器 GNU编译器套件支持的全部CPU;MARST是GNU计划成员

词法

[编辑]

简单符号

[编辑]

除了字母数字之外,ALGOL定义了运算符

优先级 运算符
第一
算术
第一 (幂)
第二 ×/(实数),÷(整数)
第三 +-
第二 <=>
第三 ¬(非)
第四 (与)
第五 (或)
第六 (蕴涵)
第七 (等价)

分界符英语Delimiter:

, . : ;
( ) [ ]

在ISO 1672标准中,用:=表示(U+2254),用*表示×;用%表示÷,用**^表示,用@表示科学记数法指数运算的底数10所用符号(U+23E8),用{表示,并且用}表示,用空格 表示在字符串中的空白字符(U+2423)。

关键字

[编辑]

ALGOL 60有24个关键字

  • array
  • begin
  • Boolean
  • comment
  • do
  • else
  • end
  • false
  • for
  • go to
  • if
  • integer
  • label
  • own
  • procedure
  • real
  • step
  • string
  • switch
  • then
  • true
  • until
  • value
  • while

还包括标准函数名字作为限制标识符:

  • abs
  • sign
  • sqrt
  • sin
  • cos
  • arctan
  • ln
  • exp
  • entier

关键字写法依赖于实现,常见的是一种叫做索绕英语Stropping (syntax)(stropping)的方法,即将关键字大写并包围在两个'之间,例如将go to写为'GOTO'。在ISO 1672标准中关键字还包括对特定符号的某种文字转写:

符号 转写 符号 转写 符号 转写 符号 转写
[ '(/' ] '/)' '(' ')'
< 'LT' > 'GT' 'LE' 'GE'
= 'EQ' 'EQV' 'NE' ¬ 'NOT'
'AND' 'OR' 'IMPL' ÷ '/'

语义

[编辑]

块与作用域

[编辑]

在ALGOL 60中,“复合语句”被定义为:包围在语句括号beginend之间的成序列的语句,形成一个复合语句。被定义为:成序列的声明,跟随着成序列的语句,并被包围在beginend之间,形成一个块;所有声明以这种方式出现在一个块中,并只在这个块中有效。[23]

一个程序是特定的一个块或复合语句,它不包含在另一个语句之中,并且不使用不包含在它之中的其他语句。在1976年的修改版语言报告中,程序只能包含在叫做“环境块”的假定总是存在的一个虚构块之中,除了可以使用在环境块中声明的过程标识符和函数指定符之外,不使用不包含在它之中的其他语句。

(quantity)被区分出如下种类:简单变量、数组、标签、switchswitch列表由标签组成[24])和过程。声明负担定义在程序中用到的量的特定属性,并给它们关联上标识符。声明包括:类型声明、数组声明、switch声明和过程声明。量的作用域是语句和表达式的集合,在其中关联于这个量的标识符的声明是有效的。所有的块,自动地介入名称目录英语Nomenclature(nomenclature)的一个新的层级:

  • 在这个块内出现的标识符,可以通过合适的声明,而被指定为局部于所论及的这个块。这个标识符在这个块里面的所表示的实体,不存在于它的外面。这个标识符在这个块外面的所表示的任何实体,在这个块里面是不可见的。
  • 除了表示标签的标识符之外,一个标识符,如果出现在一个块中,而且并非声明于这个块中,则它非局部英语Non-local variable于这个块[25],就是说它在这个块里面和在紧邻其外的层级中所表示的是同一个实体。
  • 因为块中的语句自身可以是一个块,局部和非局部于一个块的概念,必须递归地去理解,就是说非局部于一个块A的一个标识符,可是亦可否地,非局部于A是其中语句的块B

这动态的蕴涵了:在通过begin进入一个块的时候,所有为这个块声明的标识符,假定了这个给定声明的本性英语Nature (philosophy)所蕴涵的意义英语Meaning (philosophy)(significance);如果这些标识符已经被外面的其他声明所定义,这时它们被给予新的意义;在另一方面,并非为这个块声明的标识符,保持它们旧有的含义。在通过endgo to语句退出一个块的时候,为这个块声明的标识符失去它们的局部意义。声明可以标记上额外的声明符own,其效果为:在重新进入一个块的时候,自有的这些量的值将不变更而仍是上次退出时的值,然而声明的没有标记上own的变量的值是未定义的。

表达式和语句

[编辑]

在描述算法处理的程序中,主要构成者是算术表达式、布尔表达式,和得到语句标签的指定(designational)表达式。除了特定的分界符之外,表达式的构成者包括:逻辑值、数值、变量、函数指定式,和基本的算术、关系、逻辑运算符(operator)及顺序运算符。用以形成语句的关键字,在ALGOL 60中被归入顺序运算符和分隔符之中。

变量是对一个单一的指名(designation英语Designation (law))。下标(subscripted)变量指定(designate)多维数组的元素的值,这里将数组元素称为“组成元件”(component)[26]。函数指定式(designator)定义单一的数量值或逻辑值,它们是将给定的由过程声明定义的规则集合,应用于固定的实际参数集合的结果。

现在通常将变量定义为抽象的存储位置,它含有了被称为一个的某种已知或未知的信息,并且配对了关联的符号英语Symbol (programming)名字。在ALGOL 60中,某些语法单位,比如表达式及其构成者和数组标识符,被称为拥有值。各种“类型”即integerrealBoolean指称(denote)的基本的属性。

在左圆括号和匹配的右圆括号之间的表达式(parenthesized expression)自行求值,而这个值被用于后续的计算之中;因此通过适当的圆括号放置,总是可以在表达式之内安排出想要的运算次序

ALGOL 60将语句分为三类:无条件语句、条件语句和for语句。赋值语句担负将表达式的值,指派(assign)到一个或多个变量,或者在定义函数指定式的值的过程主体中指派到过程标识符;在作为指派目标的下标变量中出现的任何下标表达式,先于得出所指派之值的表达式,而按从左至右顺序求值。空无的虚设(dummy)语句不执行任何运算。过程语句负担实施调用一个过程主体的执行。

控制流程语句包括:go to跳转语句、条件语句、for循环语句。go to语句结合了无条件go to和计算go to二者,goto语句不能从块外跳转到块内的标签,但可以跳转进入复合语句。条件语句包括if语句(即if <布尔表达式> then <无条件语句>),和if语句经由关键字else与随后的语句联合在一起的形式(即<if语句> else <语句>)。ALGOL 60在if语句和for语句中介入了子句概念,算术表达式、布尔表达式和指定表达式,可以是条件表达式(即if ~ then ~ else ~[27]

由于变量和函数指定式二者的语法定义都包含表达式,表达式及其构成者的定义必须是递归的。由于成序列的语句,可以被组织成复合语句和块,语句的定义必需是递归的。ALGOL 60采用了左递归巴科斯范式(BNF)。

过程

[编辑]

在ALGOL 60中,过程声明担负定义过程标识符所关联的过程,其主要构成者是过程主体,它是一个语句或一段代码。过程主体总是表现得如同一个块,不管它是否有着块的形式;故而标记了在过程主体内语句或者主体自身的标签的作用域,永远不能延伸超出这个过程主体[28]

过程主体关联着一个头部,它规定了出现在过程主体内的代表形式参数的特定标识符。过程参数传递有两种求值策略传名调用传值调用。在过程声明中,通过对形式参数名字前导value来指定传值调用,缺省为传名调用。在过程主体是用ALGOL语言写的语句的情况下,过程语句执行它的效果,等价于在程序上进行下列操作的效果:

  • 声明为传值调用的形式参数,都要被赋值即指派上对应的实际参数的值,这些指派被认为是在进入过程主体之前显式进行的。其效果如同创建了包围着这个过程主体的一个额外的块,在其中所做的这些指派针对的是局部于这个虚构块的变量,它们具有在相应规定中给出的类型。作为结论,传值调用的变量,被认为非局部英语Non-local variable于过程主体,但是局部于这个虚构块。
  • 声明为传名调用的形式参数,在整个过程主体内,要被替代为对应的实际参数,并且只要语法上可能就对这些实际参数包围上圆括号。在通过这个名字替代处理而插入的标识符,和已经存在于过程主体之内的其他标识符,二者之间的可能冲突,将凭借对涉及到的(这个过程主体的)形式标识符或局部标识符的适合的系统性变更来避免[29]
  • 最终经过上述修改后的过程主体,被插入到过程语句的位置上并被执行。如果调用这个过程的位置,处在这个过程主体的任何非局部量[30]作用域的外面,在通过这个过程主体替代处理而插入的标识符,和在这个过程语句或函数指定式所在位置上其声明有效的标识符,二者之间的可能冲突,将通过(在发起调用的这个层级上)对后者标识符的适合的系统性变更来避免[31]

对于定义函数指定式的值的过程声明,在其过程主体中,必须出现具有过程标识符在其左侧部份中的一个或多个赋值语句,其中至少有一个必须被执行;并且这个过程标识符所关联的类型,必须通过以类型声明符作为其过程声明的最先符号的样貌来声明。最后那个这样指派的值,被用来继续此函数指定式在其中出现的表达式的求值。在这个过程主体中,这个过程标识符的不在赋值语句左侧部份中的任何出现,指示了这个过程的激活(activation)。

两个传名调用形式参数,其对应的实际参数之间可能存在依赖关系,比如第一个是整数变量i,而第二个是下标变量A[i],从而导致后者形式参数也依赖于前者形式参数,利用传名调用和这种副作用可以实现Jensen设备英语Jensen's Device[32];它典型的用于定义对应于级数过程Sum(k, l, u, ak),它有两个传名调用的形式参数:索引变量k和通项(general)表达式ak

对于交换两个参数的值的swap(x, y)过程,其过程主体定义为:t:=x; x:=y; y:=t,这种依赖性副作用会导致可能出现异常行为,由于名字替代机制相当于展开(expansion),过程语句swap(i, A[i])中下标变量A[i]的下标i未经求值,对应的过程主体就转换成为:t:=i; i:=A[i]; A[i]:=t。1964年IFIP英语International Federation for Information Processing工作组2.1英语IFIP Working Group 2.1制定了《SUBSET ALGOL 60报告》,在这个子集语言中对“完全的名字概念”(full name-concept)增加了一项限制:在名字替代(传名调用)中,实际参数只能是一个标识符或字符串。

在过程的参数列表( … <参数分界符> … )中,有可选的“) <字母串>: (”样式的参数分界符英语Delimiter[33]。众所周知的传名调用实现采用了thunk英语Thunk[a][35]Donald Knuth设计了“男人抑或男孩测试”,来区分编译器是否正确的实现了“递归和非局部引用”,这个测试用到了传名调用。

例子

[编辑]

下面是语言报告中过程声明的一个例子[b]

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,其大小为nm,其绝对值最大的         元素被传送到y,并且这个元素的下标是ik ; 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 

在1976年修改版语言报告的环境块中,定义了输入输出过程:incharoutcharlengthoutstringoutterminatorinintegeroutintegerinrealoutreal,下面以其中的outinteger作为演示例子:

procedure outinteger(channel, int);     value channel, int;     integer channel, int;     comment 将表示int的值的那些字符         加上尾随的终结符传递到channel ; begin     procedure digits(int);         value int; integer int;     begin         integer j;         comment 使用递归从右至左求值数字              但从左至右打印它们 ;         j := int ÷ 10;         int := int - 10 × j;         if j  0 then             digits(j);         outchar(channel, 0123456789, int + 1)     end digits;     if int < 0 then     begin         outchar(channel, -, 1);         int := -int     end;     digits(int); outterminator(channel) end outinteger 

这里调用到的outchar(channel, str, int),将在字符串str中对应整数int的值的那个字符,传递到通道channeloutterminator(channel),用于输出在数值之后的终结符(即空格、换行或分号)。此外,IFIP英语International Federation for Information Processing工作组2.1英语IFIP Working Group 2.1在1964年曾制定《ALGOL 60输入输出过程报告》,其中定义了insymboloutsymbollengthinrealoutrealinarrayoutarray,这里的多维数组採用了横行为主英语Row- and column-major order(Row major)次序[36]

参见

[编辑]

注释与引用

[编辑]
  1. ^ A thunk is an early limited type of closure. The environment passed for the thunk is that of the expression, not that of the called routine.[34]
  2. ^ 这里采用了1976年修改版语言报告中的代码,对原版进行的修改是增加了i := k := 1;,针对的是数组的全部元素都是0的特殊情况。
  1. ^ https://www.iso.org/standard/6126.html.
  2. ^ Peter Naur; et al. Revised Report on the Algorithmic Language Algol 60. [2022-04-14]. (原始内容存档于2007-06-25). Any occurrence of the procedure identifier within the body of the procedure other than in a left part in an assignment statement denotes activation of the procedure. 
  3. ^ 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. 
  4. ^ Revised Report on the Algorithmic Language Algol 60. 1963 [2020-04-23]. (原始内容存档于2007-06-25). 
  5. ^ ISO 1538:1984 Programming languages — ALGOL 60 (PDF). [2022-05-02]. (原始内容 (PDF)存档于2021-01-31). 
  6. ^ ISO/TR 1672:1977 Hardware representation of ALGOL basic symbols in the ISO 7-bit coded character set for information processing interchange (PDF). 
  7. ^ The Encyclopedia of Computer Languages 互联网档案馆存檔,存档日期September 27, 2011,.
  8. ^ Daylight, E. G. Dijkstra's Rallying Cry for Generalization: the Advent of the Recursive Procedure, late 1950s – early 1960s. The Computer Journal英语The Computer Journal. 2011, 54 (11): 1756–1772 [2022-05-02]. doi:10.1093/comjnl/bxr002. (原始内容存档于2013-03-12). 
  9. ^ Kruseman Aretz, F.E.J. The Dijkstra-Zonneveld ALGOL 60 compiler for the Electrologica X1 (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). 
  10. ^ Edgar T. Irons. A syntax directed compiler for ALGOL 60. Communications of the ACM, Vol. 4, p. 51. Jan. 1961 [2023-07-14]. (原始内容存档于2023-07-14). 
  11. ^ ALGOL for the LGP-30, A Comparison (PDF). Computation Center, Dartmouth College. February 16, 1962 [2023-07-14]. (原始内容存档 (PDF)于2023-05-29). 
  12. ^ 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. 
  13. ^ 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. 
  14. ^ Rechenautomaten mit Trommelspeicher页面存档备份,存于互联网档案馆), Förderverein der Technischen Sammlung Dresden
  15. ^ Mounier-Kuhn, Pierre. Algol in France: From Universal Project to Embedded Culture. IEEE Annals of the History of Computing. 2014, 36 (4): 6. ISSN 1058-6180. 
  16. ^ Stephen J. Garland, Anthony W. Knapp, Thomas E. Kurtz, A Manual for SCALP, being a Self Contained ALgol Processor for the General Precision LGP-30 (PDF), CCM-7A, Computation Center, Dartmouth College, Hanover, NH, January 1, 1964 [2023-07-14], (原始内容存档 (PDF)于2023-05-29) 
  17. ^ B.Randell, L.Russell. Algol 60 implementation (PDF). 1964 [2023-07-14]. (原始内容存档 (PDF)于2023-10-03). 
  18. ^ Jean-Claude Boussard. Design and implementation of a compiler Algol60 on electronic calculator IBM 7090/94 and 7040/44 (学位论文). Institut d'informatique et mathématiques appliquées de Grenoble: Université Joseph-Fourier - Grenoble I. June 1964 [2022-05-02]. (原始内容存档于2022-04-10). 
  19. ^ Claude Pair. Description d'un compilateur ALGOL. European Région 1620 Users Group (IBM). 27 April 1965. 
  20. ^ Kruseman Aretz, F.E.J. An ALGOL 60 compiler in ALGOL 60. Mathematical Centre Tracts. Amsterdam: Mathematisch Centrum. 1973. 
  21. ^ NASE. [2022-05-02]. (原始内容存档于2022-03-30). 
  22. ^ MARST. [2020-04-23]. (原始内容存档于2020-03-22). 
  23. ^ J. W. Backus, F. L. Bauer, J. Green, C. Katz, J. McCarthy, P. Naur, A. J. Perlis, H. Rutishauser, K. Samelson, B. Vauquois, J. H. Wegstein, A. van Wijngaarden, M. Woodger. Peter Naur , 编. Revised Report on the Algorithmic Language ALGOL 60. Communications of the ACM, Volume 6, Number 1, pages 1-17. January 1963 [2023-02-20]. (原始内容存档于2023-02-20). A sequence of statements may be enclosed between the statement brackets begin and end to form a compound statement. ……
    A sequence of declarations followed by a sequence of statements and enclosed between begin and end constitutes a block. Every declaration appears in a block in this way and is valid only for that block.
     
  24. ^ Peter Naur; et al. Revised Report on the Algorithmic Language Algol 60. [2022-04-14]. (原始内容存档于2007-06-25). A switch declaration defines the set of values of the corresponding switch designators. These values are given one by one as the values of the designational expressions entered in the switch list. With each of these designational expressions there is associated a positive integer, 1, 2, ..., obtained by counting the items in the list from left to right. The value of the switch designator corresponding to a given value of the subscript expression ( …… ) is the value of the designational expression in the switch list having this given value as its associated integer. 
    Heinz Rutishauser英语Heinz Rutishauser. Description of ALGOL 60 (PDF). Springer-Verlag New York Inc. 1967 [2023-07-06]. ISBN 978-3-642-86936-5. doi:10.1007/978-3-642-86934-1. (原始内容存档 (PDF)于2022-12-22). “25.4.3.

     
    «

    begin     switch wernik := ariea, aeryl, m17, larix;     goto wernik[k]; arica: ; comment this for k = 1 ;          goto common; aeryl: ; comment this for k = 2 ;          goto common; m17: ; comment this for k = 3 ;          goto common; larix: ; comment this for k = 4 ;      common:  end 

    ».
     

    Here, by virtue of switch wernik, the computation follows one of four possible branches of the program depending on the current value of k. Afterwards the common course of the calculation (i.e. the statements which would follow «end») is taken up again.”

  25. ^ Heinz Rutishauser英语Heinz Rutishauser. Description of ALGOL 60 (PDF). Springer-Verlag New York Inc. 1967 [2023-07-06]. ISBN 978-3-642-86936-5. doi:10.1007/978-3-642-86934-1. (原始内容存档 (PDF)于2022-12-22). “42.5.1. The operands of a block B are defined as those quantities existing outside the block which are involved in the execution of the block. Obviously the quantities global to B are operands of B provided they are actually used inside B. ……
    42.5.2. Hidden operands. A block may have hidden operands: Indeed, if a procedure P is operand of block B, …… the global parameters of P are also involved in the execution of B, hence operands of B. We call these hidden operands of B because they cannot be found by inspection of block B but only by inspection of the declaration for procedure P, which is given somewhere outside B. ……
    42.5.3. The operands of a block B fall into the following four categories:
    Arguments …… ⒝ Results …… ⒞ Transients: …… which have properties of both arguments and results …… ⒟ Exits: Labels referring to destinations located outside B and switches which are declared outside B. ……
    52.3.1. Considering a mathematical expression, e.g. an integral
        
    it is seen that the variables x and y serve entirely different purposes: y is a variable upon which the value of I depends; in mathematical logic this is called a free variable (of the expression). This latter term indicates that one is free to substitute a value, e.g. 2.75, for y, where-upon one obtains the result
        
    The variable x, on the other hand, is only an auxiliary object for describing the operation to be performed by the expression. It is called a bound variable since it is not accessible from outside the expression. ……
    52.3.2. Comparing these examples with an ALGOL procedure and the terminology used ……, it becomes obvious that the free variables correspond to what are called the operands of a procedure, while the bound variables correspond to the internal quantities.”
  26. ^ Heinz Rutishauser英语Heinz Rutishauser. Description of ALGOL 60 (PDF). Springer-Verlag New York Inc. 1967 [2023-07-06]. ISBN 978-3-642-86936-5. doi:10.1007/978-3-642-86934-1. (原始内容存档 (PDF)于2022-12-22). “9.1.2. An array is a set of elements, called the components of the array, everyone of which behaves like a simple variable. The components of an array are distinguished by a set of p integers (subscripts)i1, i2, ……, ip, where p is called the dimension of the array. If we interpret the subscripts as coordinates in a p-dimensional space, then the entire array corresponds to the total of all unit-gridpoints in a p-dimensional hyperbox
        lk ≤ ik ≤ uk  (k = 1, 2, ……, p),
    whose boundaries (i.e. the array bounds l1, l2 ……, lp, u1, u2, ……, up) are given in the corresponding array declaration ……. ……
    14.3.2. A subscripted variable «I[E1, E2, ……, Ep]», if encountered in an expression, represents also a single value defined as follows: Evaluate the subscript expressions E1, E2, ……, Ep; if their values are i1, i2, ……, ip, then the subscripted variable represents the value that has most recently been assigned to the i1, i2, ……, ip-component of the array I.”
  27. ^ Heinz Rutishauser英语Heinz Rutishauser. Description of ALGOL 60 (PDF). Springer-Verlag New York Inc. 1967 [2023-07-06]. ISBN 978-3-642-86936-5. doi:10.1007/978-3-642-86934-1. (原始内容存档 (PDF)于2022-12-22). 
    19.7.1. «x + (if t > t1 then 1 else -1) / x».
    We recall that a conditional arithmetic expression cannot be used directly as a primary in a larger expression, but must for this purpose be enclosed in parentheses (the sequence «+ if» is always illegal).
    19.7.2. Selection of a component of an array with safeguards against exceeding the array bounds:
         «a[if k > n then n else if k < 1 then 1 else k]».
    19.7.3. Where conditional expressions are intended as comparands of a relation or as alternatives of a conditional expression, they must again be enclosed in parentheses:
         «if (if u then x else y) > 0 then (if z = 0 then x + y else x - y) else x × y».”
  28. ^ Heinz Rutishauser英语Heinz Rutishauser. Description of ALGOL 60 (PDF). Springer-Verlag New York Inc. 1967 [2023-07-06]. ISBN 978-3-642-86936-5. doi:10.1007/978-3-642-86934-1. (原始内容存档 (PDF)于2022-12-22). “44.2. …… The operands of a procedure, i.e. the quantities involved in its execution, are essentially the operands of the fictitious block which - if S stands for the procedure body - is defined as the construction
        «begin real æ; S end»1, 2.
    ……
    1 The declaration of the fictitious variable æ serves solely to make this piece of program a block.
    2 In case S is already an unlabelled block, this artificial construction is unneeded and we could take S instead. ……”
  29. ^ Heinz Rutishauser英语Heinz Rutishauser. Description of ALGOL 60 (PDF). Springer-Verlag New York Inc. 1967 [2023-07-06]. ISBN 978-3-642-86936-5. doi:10.1007/978-3-642-86934-1. (原始内容存档 (PDF)于2022-12-22). “45.2.3. Name conflicts. …… Indeed, without this rule, the effect of a call «x(z)» of a

     
    «

    procedure x(y);     real y;     begin real z; z := 2 × y; y := y / z end 

    »
     

    would erroneously be interpreted as
      «begin real z; z := 2 × y; z := z / z end»,
    which certainly was not the intention of the designer of the procedure. With the above amendment, however, the internal z is changed into , after which we obtain the equivalence block correctly as
      «begin real zæ; zæ := 2 × z; z := z / zæ end».”

  30. ^ Heinz Rutishauser英语Heinz Rutishauser. Description of ALGOL 60 (PDF). Springer-Verlag New York Inc. 1967 [2023-07-06]. ISBN 978-3-642-86936-5. doi:10.1007/978-3-642-86934-1. (原始内容存档 (PDF)于2022-12-22). “44.2. Operands of a procedure …… Indeed, execution of a procedure means essentially execution of this fictitious block, …… However, it is one of the most important properties of procedures that their operands - besides being distinguished as arguments, results, transients and exits - fall into three categories, namely
    ⒜ Those operands of the fictitious block whose identifiers are not quoted in the formal parameter part are called global operands of the procedure. …… ⒝…… formal operands ……⒞…… hidden operands ……
    44.3.1. A global parameter - that is, the identifier of a global operand - represents the same quantity inside the procedure body as outside in the environment of the procedure declaration. A global operand is therefore simply the extension of a quantity which exists outside the procedure. As a consequence we have
    44.3.2. The environment rule for global parameters:
    If the identifier I is global parameter of a procedure, then a (true or formal) quantity Q with that identifier must exist in the environment of the procedure declaration, and it is this Q which in a call of the procedure is meant by the identifier I.
    According to this rule, a global parameter acts like a thread which links the procedure declaration permanently to its environment; indeed, a procedure which has global parameters is only fully defined if it is embedded into an ALGOL program in which the global operands are properly declared.”
  31. ^ Heinz Rutishauser英语Heinz Rutishauser. Description of ALGOL 60 (PDF). Springer-Verlag New York Inc. 1967 [2023-07-06]. ISBN 978-3-642-86936-5. doi:10.1007/978-3-642-86934-1. (原始内容存档 (PDF)于2022-12-22). “45.2.4. Suppressed global operands. …… Consider, for instance

     
    «

    begin     integer t;     procedure common(x); real x; t := x; z:  begin         real t;         common(t);     end z end 

    ».
     

    Here the integer type variable t is suppressed in block z, and therefore the actual parameter of the call «common(t)» refers to the real type variable which is local to block z. …… the t occurring as global parameter of procedure common refers to the suppressed quantity t. The above rule makes this evident by requiring that the name of the real type variable t be changed throughout block z into tee before the substitution rule is applied:

     
    «

    begin     integer t;     procedure common(x); real x; t := x; z:  begin         real tæ;         common(tæ);     end z end 

    ».
     

    Now the substitution rule yields the equivalent block for the call «common(t)» correctly as (æ denoting again the hypothetical variable necessary to make this piece of program a block)
      «begin real æ; t := tæ end».
    Accordingly, this call accomplishes something which would seem impossible, namely changing the value of a suppressed variable.
    45.2.5. ……Consequently no name changes apply where the identifier of a global operand not suppressed at the location of a procedure call coincides with the identifier of an actual operand.”

  32. ^ Heinz Rutishauser英语Heinz Rutishauser. Description of ALGOL 60 (PDF). Springer-Verlag New York Inc. 1967 [2023-07-06]. ISBN 978-3-642-86936-5. doi:10.1007/978-3-642-86934-1. (原始内容存档 (PDF)于2022-12-22). In view of its ad-hoc character it seems doubtful that the Jensen device (and to some extent even the full name-concept) is the last word in programming language design. Indeed, the dependence of the components of an array upon its subscripts (and likewise the dependence of a function upon its arguments) is more appropriately described by means of CHURCH'S lambda notation rather than through the bound variables of a computing process. Accordingly, we conclude with a sideview to a possibility for introducing this notation in a future ALGOL, but in doing so we strictly adhere to a SUBSET like language-concept, i.e. one in which quantities rather than names play the fundamental role. 
  33. ^ Peter Naur; et al. Revised Report on the Algorithmic Language Algol 60. [2022-04-14]. (原始内容存档于2007-06-25). Parameter delimiters. All parameter delimiters are understood to be equivalent. No correspondence between the parameter delimiters used in a procedure statement and those used in the procedure heading is expected beyond their number is the same. Thus the information conveyed by using the elaborate ones is entirely optional. 
  34. ^ E. T. Irons. Comments on the Implementation of Recursive Procedures and Blocks in ALGOL. Communications of the ACM (Association for Computing Machinery (ACM)). January 1, 1961, 4 (1): 65–69. ISSN 0001-0782. S2CID 42778823. doi:10.1145/366062.366090可免费查阅. 
  35. ^ Ingerman, P. Z. Thunks: a way of compiling procedure statements with some comments on procedure declarations. Communications of the ACM (Association for Computing Machinery (ACM)). 1961-01-01, 4 (1): 55–58. ISSN 0001-0782. S2CID 14646332. doi:10.1145/366062.366084可免费查阅. 
  36. ^ Heinz Rutishauser英语Heinz Rutishauser. Description of ALGOL 60 (PDF). Springer-Verlag New York Inc. 1967 [2023-07-06]. ISBN 978-3-642-86936-5. doi:10.1007/978-3-642-86934-1. (原始内容存档 (PDF)于2022-12-22). “49.3.2. For inarray and outarray the order in which the components of the array b are transferred is defined to be what for matrices (two-dimensional arrays) is usually called "row-wise". More precisely: b[i1, i2, ……, ip] is transferred before b[j1, j2, ……, jp] provided we have for some h ≤ p:
        il = jl for l = 1, 2, ……, h - 1, but ih < ih.
    Moreover, these procedures always transfer all components of the array appearing as the second actual operand.
    As a consequence, a call «outarray(15, p)», where p is declared e.g. as «array p[-4:5, 1:50, 0:20]», is equivalent to

     
    «

    for j1 := -4 step 1 until 5 do     for j2 := 1 step 1 until 50 do         for j3 := 0 step 1 until 20 do outreal(15, p[j1, j2, j3]) 

    ».”
     

外部链接

[编辑]