Support for the P" programming language
Opened this issue · 0 comments
dreasgrech commented
http://en.wikipedia.org/wiki/P%E2%80%B2%E2%80%B2
An excerpt from Wikipedia:
Böhm1 gives the following program to compute the predecessor (x-1) of an integer x > 0:
R ( R ) L ( r' ( L ( L ) ) r' L ) R r
which translates directly to the equivalent brainfuck program
> [ > ] < [ − [ < [ < ] ] − < ] > +
The program expects an integer to be represented in bijective base-n notation, with a1, ..., an coding the digits 1,...,n, respectively, and to have an a0 before and after the digit-string. (E.g. in bijective base-2, the number eight would be encoded as a0a1a1a2a0, because 8 = 1_22 + 1_21 + 2*20.) At the beginning and end of the computation, the tape-head is on the a0 preceding the digit-string.