First appeared 1964 | Typing discipline untyped | |
P′′ is a primitive computer programming language created by Corrado Böhm in 1964 to describe a family of Turing machines.
Contents
Definition
Syntax
- R and λ are words in P′′.
- If p and q are words in P′′, then pq is a word in P′′.
- If q is a word in P′′, then (q) is a word in P′′.
- Only words derivable from the previous three rules are words in P′′.
Semantics
Relation to other programming languages
Example program
Böhm gives the following program to compute the predecessor (x-1) of an integer x > 0:
R ( R ) L ( r' ( L ( L ) ) r' L ) R rwhich 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.