Plankalkül () is a programming language designed for engineering purposes by Konrad Zuse between 1942 and 1945. It was the first high-level programming language to be designed for a computer. Zuse never implemented Plankalkül on any of his Z-series machines.
Kalkül (from Latin calculus) is the German language term for a formal system—as in Hilbert-Kalkül, the original name for the Hilbert-style deduction system—so Plankalkül refers to a formal system for planning.
While working on his doctoral dissertation, Zuse developed the first known formal system of algorithm notation capable of handling branches and loops. In 1942 he began writing a computer chess program in Plankalkül. In 1944, Zuse met with the German logician and philosopher Heinrich Scholz, who expressed appreciation for Zuse's utilization of logical calculus. In 1945, Zuse described Plankalkül in an unpublished book. The collapse of Nazi Germany, however, prevented him from submitting his manuscript.
At that time the only two working computers in the world were ENIAC and Harvard Mark I, neither of which used a compiler, and ENIAC needed to be reprogrammed for each task by changing how the wires were connected.
Although most of his computers were destroyed by Allied bombs, Zuse was able to rescue one machine, the Z4, and move it to the Alpine village of Hinterstein (part of Bad Hindelang).
Unable to continue building computers – which was also forbidden by the Allied Powers – Zuse devoted his time to the development of a higher-level programming model and language. In 1948, he published a paper in the Archiv der Mathematik and presented at the Annual Meeting of the GAMM. His work failed to attract much attention. In a 1957 lecture, Zuse expressed his hope that Plankalkül, "after some time as a Sleeping Beauty, will yet come to life." He expressed disappointment that the designers of ALGOL 58 never acknowledged the influence of Plankalkül on their own work.
Plankalkül was republished with commentary in 1972. The first compiler for Plankalkül was implemented by Joachim Hohmann in his 1975 dissertation. Other independent implementations followed in 1998 and 2000 at the Free University of Berlin.
Many features of the Plankalkül reappear in later programming languages; an exception is its idiosyncratic two-dimensional notation using multiple lines.
Some features of the Plankalkül:
So, a sequence of eight bits (which in modern computing could be regarded as byte) is denoted by , and Boolean matrix of size by is described by . There also exists a shortened notation, so one could write instead of .
Type could have two possible values and . So 4-bit sequence could be written like L00L, but in cases where such a sequence represents a number, the programmer could use the decimal representation 9.
Record of two components and is written as .
Type () in Plankalkül consists of 3 elements: structured value (), pragmatic meaning () and possible restriction on possible values (). User defined types are identified by letter A with number, like – first user defined type.
Coordinate of chess board (it has size 8x8 so 3 bits are just enough) | ||
square of the board (for example L00, 00L denotes e2 in algebraic notation) | ||
piece (for example, 00L0 — white king) | ||
piece on a board (for example L00, 00L; 00L0 — white king on e2) | ||
board (pieces positions, describes which piece each of 64 squares contains) | ||
game state ( — board, — player to move, — possibility of castling (2 for white and 2 for black), — information about cell on which en passant move is possible |
Particular variable of some kind is identified by number, written under the kind. For example:
Programs and subprograms are marked with a letter P, followed by a program (and optionally a subprogram) number. For example , .
Output value of program saved there in variable is available for other subprograms under the identifier , and reading value of that variable also means executing related subprogram.
In modern programming languages, that would be described by notation similar to V0[0], V0[0][i], V0[0][i][j] (although to access a single bit in modern programming languages a bitmask is typically used).
First row contains variable kind, then variable number marked with letter V (), then indexes of variable subcomponents marked with K (), and then () marked with S, which describes variable type. Type is not required, but Zuse notes that this helps with reading and understanding the program.
In the line types and could be shortened to and .
Examples:
\begin{array}{r>l}
& V \\ V & 3 \\ K & \\ S & m \times 2 \times 1 \cdot n \end{array} | variable V3 — list of pairs of values of type |
\begin{array}{r>l}
& V \\ V & 3 \\ S & m \times 2 \times 1 \cdot n \end{array} | Row K could be skipped when it is empty. Therefore, this expression means the same as above. |
\begin{array}{r>l}
& V \\ V & 3 \\ K & i \cdot 0 \cdot 7 \\ S & 0 \end{array} | Value of eights bit (index 7), of first (index 0) pair, of і-th element of variable V3, has Boolean type (). |
Indexes could be not only constants. Variables could be used as indexes for other variables, and that is marked with a line, which shows in which component index would value of variable be used:
Z5-th element of variable V3. Equivalent to expression V3[Z5] in many modern programming languages. |
Zuse wrote that the expression:
& Z + 1 & \Rightarrow & Z\\ V & 1 & & 1\\ \end{array}
is analogous to the more traditional mathematical equation:
& Z + 1 & = & Z\\ V & 1 & & 1\\ K & i & & i + 1\\ \end{array}
There are claims that Konrad Zuse initially used the glyph as a sign for assignment, and started to use under the influence of Heinz Rutishauser. Knuth and Pardo believe that Zuse always wrote , and that was introduced by publishers of «Über den allgemeinen Plankalkül als Mittel zur Formulierung schematisch-kombinativer Aufgaben» in 1948. In the ALGOL 58 conference in Zürich, European participants proposed to use the assignment character introduced by Zuse, but the American delegation insisted on :=.
The variable that stores the result of an assignment (l-value) is written to the right side of assignment operator. The first assignment to the variable is considered to be a declaration.
The left side of assignment operator is used for an expression (), that defines which value will be assigned to the variable. Expressions could use arithmetic operators, Boolean operators, and comparison operators ( etc.).
The exponentiation operation is written similarly to the indexing operation - using lines in the two-dimensional notation:
The following example defines a function max3 (in a linear transcription) that calculates the maximum of three variables:
P1 max3 (V0[:8.0],V1[:8.0],V2[:8.0]) → R0[:8.0] max(V0[:8.0],V1[:8.0]) → Z1[:8.0] max(Z1[:8.0],V2[:8.0]) → R0[:8.0] END P2 max (V0[:8.0],V1[:8.0]) → R0[:8.0] V0[:8.0] → Z1[:8.0] (Z1[:8.0] < V1[:8.0]) → V1[:8.0] → Z1[:8.0] Z1[:8.0] → R0[:8.0] END
|
|