# BCPL Cintcode System

Implementation of programming language BCPL

The only modern implementation of BCPL, created by the author of the language, Martin Richards. It is written in C and BCPL itself, and is free to use for private and academic purposes.

## Examples:

### Hello, World!:

Example for versions 64-bit BCPL Cintcode System (1 Nov 2006)

`\$( ... \$)` is another form of delimiting a block. `*n` prints a newline.

``````GET "libhdr"

LET start() = VALOF
\$( writes("Hello, World!*n")
RESULTIS 0
\$)
``````

### Factorial:

Example for versions 64-bit BCPL Cintcode System (1 Nov 2006)

This example uses recursive factorial definition. Calculating 15! and larger results in math overflow, thus the result ends like this:

``````12! = 479001600
13! = 6227020800
14! = 87178291200
15! = 18000
16! = 000
``````
``````GET "libhdr"

LET start() = VALOF
{ FOR i = 0 TO 16 DO writef("%n! = %n*n", i, factorial(i))
RESULTIS 0
}

AND factorial(n) = n=0 -> 1, n*factorial(n-1)
``````

### Fibonacci numbers:

Example for versions 64-bit BCPL Cintcode System (1 Nov 2006)

This example uses recursive definition of Fibonacci numbers.

``````GET "libhdr"

LET start() = VALOF
{ FOR i = 0 TO 15 DO writef("%n, ", fibonacci(i))
writef("...*n")
RESULTIS 0
}

AND fibonacci(n) = n<2 -> 1, fibonacci(n-1)+fibonacci(n-2)
``````