BCPL, aka Basic Combined Programming Language, is a programming language created in 1966 by Martin Richards.
#397on PLDB | 58Years Old |
BCPL ("Basic Combined Programming Language"; or 'Before C Programming Language' (a common humorous backronym) ) is a procedural, imperative, and structured computer programming language. Originally intended for writing compilers for other languages, BCPL is no longer in common use. However, its influence is still felt because a stripped down and syntactically changed version of BCPL, called B, was the language on which the C programming language was based. Read more on Wikipedia...
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"
LET START() BE
$(
WRITES("Hello World*N")
$)
// Hello world in BCLP
GET "libhdr"
LET start() = VALOF
$( writes("Hello world*N")
RESULTIS 0
$)
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
$)
Feature | Supported | Example | Token |
---|---|---|---|
Assignment | ✓ | := | |
Print() Debugging | ✓ | WRITES | |
Comments | ✓ | // A comment | |
Line Comments | ✓ | // A comment | // |
Semantic Indentation | X |