Loading AI tools
多範式編程語言 来自维基百科,自由的百科全书
基本组合编程语言(英语:Basic Combined Programming Language),是一种计算机程序设计语言,源自更早的CPL语言,1967年由剑桥大学的马丁·理察德所发展出来的[1] 。
Richards试着移除了CPL中最复杂的组成,第一支BCPL compiler在IBM 7094电脑中完成。身为早期编程语言的BCPL,如今已不再广泛使用,但它的影响却是深远的,今日流行的C语言即是参考BCPL所设计[2]。BCPL被认定为第一个花括号编程语言[3],作为BCPL后代语言,C语言使用花括号来表示块结构。
下列是马丁查理斯的BCPL发行中的范例。
打印阶乘:
GET "LIBHDR"
LET START() = VALOF $(
FOR I = 1 TO 5 DO
WRITEF("%N! = %I4*N", I, FACT(I))
RESULTIS 0
$)
AND FACT(N) = N = 0 -> 1, N * FACT(N - 1)
GET "LIBHDR"
GLOBAL $(
COUNT: 200
ALL: 201
$)
LET TRY(LD, ROW, RD) BE
TEST ROW = ALL THEN
COUNT := COUNT + 1
ELSE $(
LET POSS = ALL & ~(LD | ROW | 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("%I2-QUEENS PROBLEM HAS %I5 SOLUTIONS*N", I, COUNT)
ALL := 2 * ALL + 1
$)
RESULTIS 0
$)
Seamless Wikipedia browsing. On steroids.
Every time you click a link to Wikipedia, Wiktionary or Wikiquote in your browser's search results, it will show the modern Wikiwand interface.
Wikiwand extension is a five stars, simple, with minimum permission required to keep your browsing private, safe and transparent.