.bes.is

A "concatenative language"

Predefined operations
dup

Duplicates the top value on the stack

[1, 2, 3] dup
[1, 1, 2, 3]
drop

Drops the top value on the stack

[1, 2, 3] drop
[2, 3]
swap

Swaps the top two values on the stack

[1, 2, 3] swap
[2, 1, 3]
skip

Skips forward in the program by the amount on the top of the stack. If the value on the top of the stack is 0 or negative, the value is dropped and the program does not skip ahead.

[1, 2, 3] skip drop dup
[2, 3] dup
[2, 2, 3]
Or
[-1, 2, 3] skip drop dup
[2, 3] drop dup
[3] dup
[3, 3]
: word ... ;

Creates a new definition.

Example: ": double 2 * ;" defines a new word called double. Any subsequent mention of double will replace the word with its definition.

[] : double 2 * ; 3 double
[] 3 double
[3] double
[3] 2 *
[2, 3] *
[6] <==
Example programs
Factorial Replace program
                    : counter   dup 2 swap - ;
                    : !   dup 1 - counter skip ! * ;
                    7 !