CPL(英語:Combined Programming Language,原名Cambridge Programming Language),一種計算機程式語言。源自於ALGOL 60,在1963年,由英国的剑桥大学和伦敦大学首先開發出來。CPL语言在ALGOL 60的基础上更接近硬件一些,但规模比较大,难以实现。BCPL是它的後繼語言。
| 编程范型 | 多范型: 过程式, 指令式, 结构化, 函数式 |
|---|---|
| 設計者 | Christopher Strachey等 |
| 发行时间 | 1963年 |
| 受影响于 | |
| ALGOL 60 | |
| 影響語言 | |
| BCPL, POP-2 | |
例子
编辑下面是Christopher Strachey等人在1963年论文中举出了的例子,它对应ALGOL 60报告中欧拉变换的例子:
function Euler [function Fct, real Eps, integer Tim] = result of
|| Euler computes the sum of Fct[i] for i from zero up to infinity by
|| means of a suitably refined Euler transformation. The summation is
|| stopped as soon as Tim times in succession the absolute value of
|| the terms of the transformed series are found to be less than Eps.
|| Hence, one should provide a function Fct with one integer argument,
|| an upper bound Eps, and an integer Tim. The output is the sum Sum.
|| Euler is particularly efficient in the case of a slowly convergent
|| or divergent alternating series.
§1 dec §1.1 real Mn, Ds, Sum
integer i, t
index n = 0
m = Array [real, (0, 15)] §⃒1.1
i, t, m[0] := 0, 0, Fct[0]
Sum := m[0]/2
§1.2 i := i + 1
Mn := Fct[i]
for k = step 0, 1, n do
m[k], Mn := Mn, (Mn + m[k])/2
test Mod[Mn] < Mod[m[n]] ∧ n < 15
then do Ds, n, m[n+l] := Mn/2, n + 1, Mn
or do Ds := Mn
Sum := Sum + Ds
t := (Mod[Ds] < Eps) → t + 1, 0 §⃒1.2
repeat while t < Tim
result := Sum §⃒1.
result of或实现为value of,同时result :=或实现为result is。与开符号§相匹配的闭符号是有竖杠贯穿的§。这个符号在Unicode中可以复合为§⃒,它是§(U+00A7)复合于 ⃒(U+20D2),但在浏览器中不一定能正确的显示出来这个§⃒。
实现
编辑据认为CPL在1960年代从未被完全实现,它是作为具有一些关于部份实现的研究工作的理论性构造而存在的[1][2]。
Peter Norvig曾经用Yapps(一个Python编译器生成器)为现代机器写出了一个简单的CPL到Python转译器[3][4]。
引用
编辑- ^ Coulouris, G. F. The London CPL1 compiler. The Computer Journal. 1 January 1968, 11: 26–30. doi:10.1093/comjnl/11.1.26 (英语).
- ^ Coulouris, George. Computer Resurrection Issue 62 / The Compiler Compiler - Reflections of a User 50 Years On / The CPL1 Compiler. Computer Conservation Society. 2013 [2023-05-03].
- ^ Peter Norvig. Prescient but Not Perfect: A Look Back at a 1966 Scientific American Article on Systems Analysis. Blogs.scientificamerican.com. [2013-08-18].
- ^ Norvig, Peter. Complete Annotated Checkers Program. norvig.com. [11 June 2021].
参考书目
编辑- Collected papers of Christopher Strachey, section pertaining to CPL, archived at the Bodleian Library, Oxford; CSAC 71.1.80/C.136-C.184(页面存档备份,存于互联网档案馆)
- Barron, D. W.; Buxton, J. N.; Hartley, D. F.; Nixon, E.; Strachey, C. The Main Features of CPL (PDF). The Computer Journal. 1963-08-01, 6 (2): 134–143. ISSN 0010-4620. doi:10.1093/comjnl/6.2.134 (英语).
- J. Buxton, J. C. Gray, and D. Park. CPL Elementary Programming Manual, Edition II (Cambridge)(页面存档备份,存于互联网档案馆).
- University of London Institute of Computer Science and The Mathematical Laboratory, Cambridge. CPL Working Papers(页面存档备份,存于互联网档案馆).










