Conquer and divide

From Esolang
Jump to navigation Jump to search

Conquer and divide or CAD is User:Yayimhere's attempt at a simple turing complete concatenative language. It is quite the simple language. It is inspired by Underflow, Underload, Combine and continue, and a Minsky machine. Specifically, it tries to use "x" from Underflow as its main command, as well as Combine and continue's comb. It uses an unlimited stack of unlimited length strings.

Commands

Conquer and divide has quite the simple command set, described below:

  • | splits the top string into each individual char, pops the top of stack, and concatenates each symbol of the stack until the symbol being concatenated changes(for examples if it reaches a pointer where a and b would be concatenated). If the split splits only into one character, then goto command n, where n is the unary amount the | repeats. The same applied to if it splits into *no* characters, However in this case, the pop still applied.
  • "x" push any string x to the stack, in which the string can at max be one character long. The special symbol * pushes the rightmost character of the top string of the stack
  • . pop the top two elements of the stack and push them again, concatenated, with the top string being rightmost in the concatenated one, then swap top two elements of the stack
  • \ separates commands. Initiates and terminates the program

the last command must be the empty space(still with spaces), or a NOP(and then a \). Command indexing starts at 2.

Computational class

Conquer and divide is Turing complete as a ESMMN to Noddity to CAD translation is possible, with the program starting with \ "a" \ "b" :

x:y -> sd*y -> \ "" \ . \ |*y+1
℘y: -> si -> \ "" \ . \ "*" \ . \ "" \ . 
℘xy -> d*y -> \ |*y+1
℘y -> i -> \ "*" \ . \ "" \ . 
℘x -> g*x -> \ "" \ |*x+1
℘ -> h -> \ "" \ |*x where x is the index of the last program command

Note that x: notates that the register chosen is different from the last one chosen, and its absence notates it is not different. Also note that x*n notates command x repeated n times.

See also