Cantor

From Esolang
Jump to navigation Jump to search
This is still a work in progress. It may be changed in the future.
Cantor
Paradigm(s) Stack-based
Designed by User:Joe
Appeared in 2024
Computational class Turing complete
Major implementations In Factor (GitHub)
File extension(s) .cntr

Cantor is an esolang created by User:Joe, in 2024, after imagining a stack based language with minimal/no stack shuffling. It is named after George Cantor for his work on infinities.

Overview

Cantor consists of access to infinitely many stacks, and there are only a few operations you can do on these stacks. There is a catch though. To encourage the use of varying stacks, every stack can only store 7 items (so people just don't use the first 2 stacks).

Its basically a tape of stacks. Kinda a weird brainf***.

Commands

The integers can be both positive and negative. Positive numbers indication movement to the right, and negative to the left.

The number 0 can be used to refer to the current stack. For instance, >0 wont move the stack, and =0 dups the top item on the stack.

If an item is copied or moved to a full stack, it is removed.

(...) can be used for comments.

>n :
moves the current stack n away.
=n :
copies the value at the top of the current stack to the top of stack n away
#m :
moves the value at the top of the current stack to the top of stack n away (the value on the top of the current stack is popped off)
[...] :
push string (the text within the brackets) to the top of the current stack
! :
include the string on the current stack into the actual program (to evaluate it)
+ :
concatenate the top two strings on the current stack.
^ :
output the top string on the current stack, popping it (I view this as an extra command just for IO. not necessary for the spirit of cantor)

Turing Completeness

WARNING: NOT A CORRECT PROOF

(I am not too sure if this is a full proof yet, because it doesn't take into account that each stack can only hold 7 items)

On the Underload page, it is shown that :()^ is a Turing Complete reduction. And for Cantor, we can show that it can perform these operations.

: = n=n
where n is an arbitrary stack. (n=n copies its top value to the top of the stack)
() = []n
^ = !n

We are done. (I think)

Example Programs

Hello, world!

[Hello, world!]^

Infinite Loop

[=0!]=0!

Truth Machine

(Based off of the Underload Truth Machine) There is no input, so [] on the top of the stack represents 0, and a [#7] represents 1. There example below has an input of 1.

[#7][[1]^=0!]#1#2>1#-1>1#-2>-2[[0]^]#1#2>1#-1>1#-2>-2!=0!
(7 is the garbage stack)

Implementations

Factor implementation https://github.com/JosephOziel/cantor