str
Jump to navigation
Jump to search
- Not to be confused with another language with the same name created by Conor O'brien.
str is a esolang created by User:cleverxia but it has nothing to do with strings. The name actually means "stack roll".
As its name suggests, it uses a stack (with unbunded integers)
The two instructions
0: push a 0.
1: pop a number x, roll the stack top x numbers down, and then increment the (new) stack top.
(Yes, they're the only 2 instructions)
Program runs indefinitely.
Halting behavior
These 3 behaviours of halting are defined:
- halt when the program is going to roll a number below the bottom of the stack
- the stack has an infinite number of zeroes at the bottom, program will not halt
- the stack has an infinite number of -1's at the bottom, rolling a number -1 numbers down halts the program
Computational class
I don't know. In fact, I don;t even know whether it is as strong as a PDA. Could someonoe prove it?
I/O extension
- This is still a work in progress. It may be changed in the future.
Examples
- This is still a work in progress. It may be changed in the future.
Interpreter
code=`input code here, not zeroes or ones are comments`
halting_behaviour=2
H=halting_behaviour;s=[];p=t=>s.length?s.pop():(H==1?process.exit():2-H)
function roll(x){if(!~x)process.exit();let f=p(),t=[];while(x--)t.push(p());s.push(f);s=s.concat(t.reverse())}
q=[...code].map(t=>(['s.push(0)','roll(p())'][t]??'')).join`
`;eval(`while(1){${q}}`)