SubI machine

From Esolang
Jump to navigation Jump to search

SubI machine is an virtual esomachine(can be considered as esolang) created by User:Слон из ЖЕЛЕЗА. It operates on complex numbers, which are written in base i-1.

SubI machine
Paradigm(s) procedural
Designed by User:Слон из ЖЕЛЕЗА
Appeared in 2023
Memory system complex-indexed array
Dimensions two-dimensional
Computational class Turing-complete
Reference implementation In external resources
File extension(s) .subi, .txt

Execution

Firstly the string, which is made out of 0s,1s and newlines(you can use whitespaces, but they are ignored). The string is separated and stored in a complex-indexed array as words - numbers in base i-1 with a certain length(specified in config). The instruction pointer starts at 0, then it goes to the direction of 1 and finds commands with arguments next to it.

Commands

Command(as a word of length 13) Command(as a number) Description
1111111111111 -38+13i Ends program
0000001110111 3i Prints at the position of the 1st argument the chracter of the code, that is the real value of the 2st argument, with curses atributes of the imag value.
0110111001100 42 Goto.
0000110011110 5-7i If the value under the argument is 0, then go up by i, else skip.
0000110011110 2+17i Adds 2nd argument to the value under the first argument.
0000100011111 14+i Copies the value under the second argument to the cell under the first.
0001101110111 19i Shifts by the value under the second argument value under the first.
0110110110110 39-13i getch(), value stored under the argument.
0000000011101 -1 Negates the argument.
0000001100000 4+4i Performs SubIwise and.
1111110011111 -42+9i Performs SubIwise or.

Turing-completeness

SubI machine can simulate BrainFuck, so it's turing-complete.

Todo: how to translate a brainfuck program to SubI machine

External Resources

Implementation