P′′ - Wikipedia
From Wikipedia, the free encyclopedia
Paradigm | Imperative, structured |
---|---|
Designed by | Corrado Böhm |
First appeared | 1964 |
Typing discipline | untyped |
Dialects | |
Brainfuck | |
Influenced | |
Brainfuck |
P′′ (P double prime[1]) is a primitive computer programming language created by Corrado Böhm[2][3] in 1964 to describe a family of Turing machines.
(hereinafter written P′′) is formally defined as a set of words on the four-instruction alphabet
, as follows:
and
are words in P′′.
- If
and
are words in P′′, then
is a word in P′′.
- If
is a word in P′′, then
is a word in P′′.
- Only words derivable from the previous three rules are words in P′′.
Relation to other programming languages
[edit]
Böhm[2] gives the following program to compute the predecessor (x-1) of an integer x > 0:
which translates directly to the equivalent Brainfuck program:
The program expects an integer to be represented in bijective base-k notation, with encoding the digits
respectively, and to have
before and after the digit-string. (E.g., in bijective base-2, the number eight would be encoded as
, because 8 in base-2 is 1000, reverse the digits, and add one to each of them.) At the beginning and end of the computation, the tape-head is on the
preceding the digit-string.
- ^ "PDBL: A tool for Turing machine simulation". GitHub. 4 September 2021.
- ^ a b c Böhm, C.: "On a family of Turing machines and the related programming language", ICC Bull. 3, 185-194, July 1964.
- ^ a b Böhm, C. and Jacopini, G.: "Flow diagrams, Turing machines and languages with only two formation rules", CACM 9(5), 1966. (Note: This is the most-cited paper on the structured program theorem.)
- P′′Online interpreter: Demonstrating the iterative 99 Bottles of Beer song construed in 337568 P′′ instructions.