Celum

From Esolang
Jump to navigation Jump to search

Celum is a programming language invented by User:Zzo38 in 2006.

Each line can start with 0: or 1: and then a label name (not case sensitive, can even be blank or duplicates, can contain any ASCII character 33 to 126 except a colon), and then another colon, and then the commands of that line (white-space is ignored). Lines starting with c: or C: is comments. The memory is a unbounded tape in both directions, each cell can store one bit, all start with 0. Also one flag independent of the tape that stores one bit and starts with 0.

The valid commands are:

  • 2 hex digits (not case sensitive) = Execute cellular automaton rule on the entire tape
  • { = Swap value of bit in middle of tape and then search upwards in the program for a line with the new value of the middle bit at the beginning and start to execute that line.
  • } = Swap value of bit in middle of tape and then search downwards in the program for a line with the new value of the middle bit at the beginning and start to execute that line.
  • i = Input one bit to middle of tape
  • o = Output bit of middle of tape
  • ? = Will not execute the rest of this line if flag is zero
  • ! text = Swap value of flag, and then goto label of name of text (must be last command on this line). Searches forward in program and wraps around from beginning. If you goto a undefined label then the program is terminated.

The program flow starts from the first line and will go to the next line, and terminate at the end of the last line, if it doesn't jump anywhere.

Example

Example (input to output forever):

0::io!

Convert Boolfuck to Celum

C: +
 0::}
 1::
C: ; (or .)
 0::o
C: ,
 0::i
C: >
 0::F0
C: <
 0::AA
C: [ (# must be replaced by a unique loop name)
 0:#0:33}
 1::33!x
 0::}
 1::!#1
 1:x:
C: ] (# must be replaced by a unique loop name)
 0::!#0
 1:#1:33