Joke computer programming language
Joke computer programming language or JCPL is an esolang created by User:None1, it runs on an imaginary joke 1-bit binary computer.
It has a tape with 2 bits and a memory pointer initially at the first bit. In the beginning, the program (represented as binary bits) itself is written into the tape from the first bit to the second, bits that are not written stay 0. It can be seen that a program in JCPL has to be at most 2 bits long, so there are only 7 valid programs.
There are only two commands, represented by the binary bit
||Bitwise not current bit|
||Move the pointer to the other bit|
For instance, take this program:
as an example
Initially, the tape is:
In the first command
0, the first bit is negated, thus becomes:
In the second command
1, the pointer moves to the second bit, thus becomes:
c=input() if len(c)>2: raise SyntaxError('Invalid program') tape= for i in c: if i in '01': tape.append('01'.index(i)) else: raise SyntaxError('Invalid program') while len(tape)<2: tape.append(0) p=0 for i in range(len(c)): if i: p=1-p else: tape[p]=1-tape[p]