Talk:ObCode
Turing Completeness Proof
Sometimes clicking "random page" pays off. I really like this language; like ///, it's very, I don't know, pure. I ended up writing what I'm pretty sure is a Bitwise Cyclic Tag simulator in it, and I was hoping someone could check my work before I put it on the main page.
( define stack flip: PUSH ( ()(())() ) PUSH ( PUSH () STORE PUSH (LOAD CAT STORE) WHILE LOAD USING ) DEF define 0: PUSH ((()())(())()((())())(()())) PUSH ( (()(())()) STORE (()(())()) ) DEF define 10: PUSH (()(()())(()())(())()((())())(()())) PUSH ( (()(())()) STORE LOAD (()(())()) PUSH () USING PUSH (( STORE PUSH () STORE )) LOAD WHILE END CAT END LOAD CAT USING ) DEF define 11: PUSH (()(()())()(()())) PUSH ( (()(())()) STORE LOAD (()(())()) PUSH () USING PUSH (( NOP STORE )) LOAD WHILE END CAT END LOAD CAT USING ) DEF PUSH ( data goes here ) USING PUSH ( program goes here ) WHILE )
It works by encoding data-1 as a program that stores a value (()(()())), and data-0 as a program that throws out a value ((()())(())()((())())(()())). When a command-1 is run, it gets the data bit at the beginning of the string, runs it as a program, then cats the the data string and the register (which has () in it if the data-0 program was run).
DEF instruction parameter order
According to the instruction list, the DEF instruction ((()())())
"pop[s] a, pop[s] b. Redefine[s] b as an instruction that does a." So, you first push the instruction name, then the code. But the truth-machine does it the other way round: it pushes the code first, then the name ()
. The code in this topic is written according to the list, but I doubt the writer tried to understand the truth machine.
So, now I have written an interpreter, and I wrote it according to the instruction list. I'm not sure if it is a mistake in the list or in the example, and I'd like to know if there's anyone (e.g. the creator) who knows this.