ALT-4

From Esolang
Jump to navigation Jump to search

ALT-4 is an esolang by User:PythonshellDebugwindow.

Commands

Command Meaning
0 Push 0 to the stack
1 Pop from the stack
01 If the stack is empty, jump to the matching 10
10 If the stack is not empty, jump to the matching 01
2 Scan a filename between this 2 and the next 2 (non-inclusive) and multithread that file
3 Nop
4 See #Interfile stack manipulation

The programs 01 and 10 both parse into two separate commands, and the program 010 parses into [0, 1, 0] as it would have an unmatched bracket otherwise.

Multithreading

When a new file is multithreaded, its instructions execute in parallel with all other multithreaded files. For example, if file F multithreads file G, then every time an instruction in F is executed, an instruction in G is executed right afterwards (execution order is the order the files were multithreaded in). Multithreading by multithreaded files, including recursive multithreading, is allowed. Each file has its own stack, which doesn't get reset when the file finishes executing (stacks don't get kept between multiple runs of the program, however).

Interfile stack manipulation

When 0, 1, 01, or 10 is preceded by 4fname4, that command uses the stack of the file fname (or a special "nil stack" that's always empty, even when pushed to, if the file fname hasn't been multithreaded yet) instead of that of its file. This might be enough for Turing-completeness, as one can multithread an empty file to gain access a new stack (e.g., a Minsky machine).

Examples

Empty the stack

Usable within programs.

01110

Infinite loop

00110

Truth-machine

Prepend a 0 for input 1.

01010

Computational class

Presumed Turing complete; see #Interfile stack manipulation.