Coeus

From Esolang
Jump to navigation Jump to search

Coeus is an esolang inspired (loosely) by 3-cell brainf*ck. It uses 4 registers (A-D). A is initially 1 and all others are 0.

Commands

X and Y represent any register.

Command Meaning
aX Print value stored in X.
bX Multiply A and X, store result in A.
cX Set X to 1/X.
dX Increment X.
eX Decrement X.
fX Swap A and X.
gX Set X to n, where A = kXn and X doesn't divide k.
hX Set X to input.
[XY][m][n] Program m is ran independently of the main program. After m halts, set V = register Y. While register X from the main program doesn't equal V, run n.

Example Programs

Truth Machine:

hA[AB][][aA]aA

Factorial:

hB[BB][][bBeB]aA

Infinite counter starting from 0:

[BB][eB][aBdB]

CAT program which terminates upon a user input of 0:

[AB][][hAaA]

Interpreters

GitHub contains a Coeus interpreter implementation in Common Lisp.