Collection
zero Useful+1
zero

BCPL

Early high-level languages
Basic Combined Programming Language (BCPL) is an early high-level language.
Chinese name
BCPL
Foreign name
Basic Combined Programming Language
Nature
An early high-level language
Scope of application
UNIX Common development languages on
Generation time
1967

brief introduction

Announce
edit
Basic Combined Programming Language(BCPL), 1967 by University of Cambridge Matin Richards, also developed by Cambridge University CPL Language It has been improved. BCPL was first used as Oxford The development tool on the OS6 operating system. Later adopted Bell Lab The improvement and promotion of UNIX Common development languages on.
BCPL is somewhat similar to Fortran , also typical Process oriented The high-level language of. The syntax of BCPL is closer to the machine itself, which is suitable for developing sophisticated and demanding applications compiler The requirements are not high. BCPL is also one of the first languages to use library functions to encapsulate basic input and output, which makes it very portable across platforms. The code of BCPL is written in lowercase letters, which is different from that of the same era BASIC and PASCAL BCPL's support for strings is poor, and this shortcoming has continued to his descendants. BCPL's memory management is also poor, but fortunately this shortcoming has been eliminated in his descendants. BCPL program from a Principal function Starting from, function modules can be added to various functions, and functions support nesting and recursion.
BCPL itself has not been used for a long time, because its descendants are too powerful. In 1970, Bell Laboratories Ken Thompson On the basis of BCPL Language B , used to write UNIX. This name is taken from the first letter in BCPL. B language was used for a shorter time, because three years later, in 1973, it was also D M. RITCHIE further improves the B language, and takes the second letter in BCPL to name it C language C and C++ Will become the most popular in the future high-level language

example

Announce
edit
The following is Martin Charles' 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 queen questions: N queen questions: 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("Number of solutions to %i2-queens is %i5*n", i, count) all := 2*all + 1 } RESULTIS 0 }