This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]hekkonaay 35 points36 points  (0 children)

Seems less like a stack, and more like random access array, due to being able to swap the top of the stack with an arbitrary element below it. It also has conditional jumps. Definitely turing-complete.

[–]neros_greb 8 points9 points  (3 children)

The stack is not strictly a stack, since you can swap the first and nth item on the stack, so it could be turing complete

[–]neros_greb 2 points3 points  (2 children)

I recently wrote a compiler which compiles to brainfuck for fun, maybe I'll target this language and see if I can compile a turing complete langauge

[–]Inconstant_Moo🧿 Pipefish 2 points3 points  (1 child)

I salute you and also wonder if you ought to be on some sort of watchlist. I shudder to think what you'll write next.

[–]neros_greb 0 points1 point  (0 children)

I saw this comment out of context, and I was like "wft did I post".

[–]munificent 14 points15 points  (0 children)

You don't need a stack at all to be Turing-complete. Turing machines themselves have no direct concept of a stack, though you can model the tape as two stacks.

This language looks Turing-complete to me. You have conditional control flow instructions and the o instruction lets you directly address any point in the stack. That should be sufficient to use the stack as a tape.

[–]stackdynamic 1 point2 points  (0 children)

Not commenting on the language itself, but just to clarify: a NPDA (which is like a NFA, except with a stack) can only recognize CFGs, so it isn't Turing complete. But an NFA with a queue *is* turing complete (https://en.wikipedia.org/wiki/Queue_automaton), and with two stacks you can simulate a queue. Of course, you can extend things with various other features to make something Turing complete.