BCPL

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








BCPL
编程范型
过程式,命令式,结构化
設計者
馬丁·理察德
发行时间
1966
啟發語言

CPL
影響語言

B语言(间接影响C语言)

BCPL(Basic Combined Programming Language),是一種電腦程式設計語言,源自更早的CPL語言,1966年由劍橋大學的馬丁·理察德(Martin Richards)所發展出來的。


Richards試著移除了CPL中最複雜的組成,第一支BCPL compiler在IBM 7094電腦中完成。


身為早期程式語言的BCPL,如今已不再廣泛使用,但它的影響卻是深遠的,今日流行的C語言即是參考BCPL所設計。BCPL是第一支使用括弧語言,括弧特徵在C語言中隨處可見,例如


BCPL
LET FUNC foo(a) = VALOF
b := a + 1
RESULTIS b

C語言改良自BCPL
for (int i = 0; i < 10; i++)

printf("%d", i);
doTask(i);



範例


下列是馬丁查理斯的 BCPL distribution.


Printing factorials:


GET "libhdr"

LET start() = VALOF
FOR i = 1 TO 5 DO writef("fact(%n) = %i4*n", i, fact(i))
RESULTIS 0


AND fact(n) = n=0 -> 1, n*fact(n-1)

N個皇后問題:


GET "libhdr"

GLOBAL count:200; all:201

LET try(ld, row, rd) BE TEST row=all

THEN count := count + 1

ELSE rd)
UNTIL poss=0 DO
LET p = poss & -poss
poss := poss - p
try(ld+p << 1, row+p, rd+p >> 1)



LET start() = VALOF
all := 1

FOR i = 1 TO 12 DO
count := 0
try(0, 0, 0)
writef("Number of solutions to %i2-queens is %i5*n", i, count)
all := 2*all + 1


RESULTIS 0



參考文獻


  • Martin Richards, The BCPL Reference Manual (Memorandum M-352, Project MAC, Cambridge, July, 1967)

  • Martin Richards, BCPL - a tool for compiler writing and systems programming (Proceedings of the Spring Joint Computer Conference, Vol 34, pp 557-566, 1969)

  • Martin Richards, Arthur Evans, Robert F. Mabee, The BCPL Reference Manual (MAC TR-141, Project MAC, Cambridge, 1974)

  • Martin Richards, C. Whitby-Strevens, BCPL, the language and its compiler (Cambridge University Press, 1980) ISBN 0-521-28681-6

Popular posts from this blog

倭马亚王朝

Gabbro

托萊多 (西班牙)