Plankalkül

From HandWiki
Short description: Programming language designed 1942 to 1945

Plankalkül
ParadigmProcedural
Designed byKonrad Zuse
First appeared1948; 77 years ago (1948) – concept first published
Major implementations
Plankalkül-Compiler by the FU Berlin in 2000
Influenced by
Begriffsschrift[1]
Influenced
Superplan, ALGOL 58[2]

Plankalkül (German pronunciation: [ˈplaːnkalkyː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.

Kalkül is the German 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.[3]

History of programming

In the domain of creating computing machines, Zuse was self-taught, and developed them without knowledge about other mechanical computing machines that existed already – although later on (building the Z3) being inspired by Hilbert's and Ackermann's book on elementary mathematical logic (see Principles of Mathematical Logic).[4](pp113, 152, 216) To describe logical circuits, Zuse invented his own diagram and notation system, which he called "combinatorics of conditionals" (German: Bedingungskombinatorik). After finishing the Z1 in 1938, Zuse discovered that the calculus he had independently devised already existed and was known as propositional calculus.[5](p3) What Zuse had in mind, however, needed to be much more powerful (propositional calculus is not Turing-complete and is not able to describe even simple arithmetic calculations[6]). In May 1939, he described his plans for the development of what would become Plankalkül.[4](pp113, 152, 216) He wrote the following in his notebook:


Seit etwa einem halben Jahr allmähliches Einführen in die formale Logik. Viele meiner früheren Gedanken habe ich dort wiedergefunden. (Bedingungskombinatorik = Aussagenlogik; Lehre von den Intervallen = Gebietenkalkül). Ich plane jetzt die Aufsetzung des 'Plankalküls'. Hierzu sind eine Reihe von Begriffen zu klären.

Almost half a year of gradual introduction into formal logic. I rediscovered there lots of my previous thoughts. (combinatorics of conditionals = propositional calculus; study of intervals = lattice theory). I now plan the adoption of "Calculus of plans" onto this. A series of concepts need to be clarified for this.

—Konrad Zuse's notebook[7]:3
Historical marker on house in Hinterstein (de) where Zuse worked on Plankalkül

While working on his doctoral dissertation, Zuse developed the first known formal system of algorithm notation[8](p9) capable of handling branches and loops.[9](p18)[4](p56) In 1942 he began writing a chess program in Plankalkül.[4](pp216-217) In 1944, Zuse met with the German logician and philosopher Heinrich Scholz, who expressed appreciation for Zuse's utilization of logical calculus.[10] In 1945, Zuse described Plankalkül in an unpublished book.[11] The collapse of Nazi Germany, however, prevented him from submitting his manuscript.[9](p18)

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.[5](p3)

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[8](p8) (part of Bad Hindelang).

Unable to continue building computers – which was also forbidden by the Allied Powers[12] – Zuse devoted his time to the development of a higher-level programming model and language.[9](p18) In 1948, he published a paper in the Archiv der Mathematik and presented at the Annual Meeting of the GAMM.[4](p89) His work failed to attract much attention.[citation needed] In a 1957 lecture, Zuse expressed his hope that Plankalkül, "after some time as a Sleeping Beauty, will yet come to life."[5](p3) He expressed disappointment that the designers of ALGOL 58 never acknowledged the influence of Plankalkül on their own work.[9](p18)[8](p15)

Plankalkül was republished with commentary in 1972.[13] The first compiler for Plankalkül was implemented by Joachim Hohmann in his 1975 dissertation.[14] Other independent implementations followed in 1998[15] and 2000 at the Free University of Berlin.[5](p2)

Description

Plankalkül has drawn comparisons to the language APL, and to relational algebra. It includes assignment statements, subroutines, conditional statements, iteration, floating-point arithmetic, arrays, hierarchical record structures, assertions, exception handling, and other advanced features such as goal-directed execution. The Plankalkül provides a data structure called generalized graph (verallgemeinerter Graph), which can be used to represent geometrical structures.[16]

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:[4](p217)

  • only local variables
  • functions do not support recursion
  • only supports call by value
  • composite types are arrays and tuples
  • contains conditional expressions
  • contains a for loop and a while loop
  • no goto

Data types

The only primitive data type in the Plankalkül is a single bit or Boolean (German: Ja-Nein-Werte – yes-no value in Zuse's terminology). It is denoted by the identifier [math]\displaystyle{ S0 }[/math]. All the further data types are composite, and build up from primitive by means of "arrays" and "records".[17](p679)

So, a sequence of eight bits (which in modern computing could be regarded as byte) is denoted by [math]\displaystyle{ 8 \times S0 }[/math], and Boolean matrix of size [math]\displaystyle{ m }[/math] by [math]\displaystyle{ n }[/math]  is described by [math]\displaystyle{ m \times n \times S0 }[/math]. There also exists a shortened notation, so one could write [math]\displaystyle{ S1 \cdot n }[/math] instead of [math]\displaystyle{ n \times S0 }[/math].[17](p679)

Type [math]\displaystyle{ S0 }[/math] could have two possible values [math]\displaystyle{ 0 }[/math] and [math]\displaystyle{ L }[/math]. 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.[17](p679)

Record of two components [math]\displaystyle{ \sigma }[/math] and [math]\displaystyle{ \tau }[/math] is written as [math]\displaystyle{ (\sigma, \tau) }[/math].[17](p679)

Type (German: Art) in Plankalkül consists of 3 elements: structured value (German: Struktur), pragmatic meaning (German: Typ) and possible restriction on possible values (German: Beschränkung).[17](p679) User defined types are identified by letter A with number, like [math]\displaystyle{ A1 }[/math] – first user defined type.

Examples

Zuse used a lot of examples from chess theory:[17](p680)

[math]\displaystyle{ A1 }[/math] [math]\displaystyle{ S1 \cdot 3 }[/math] Coordinate of chess board (it has size 8x8 so 3 bits are just enough)
[math]\displaystyle{ A2 }[/math] [math]\displaystyle{ 2 \times A1 }[/math] square of the board (for example L00, 00L denotes e2 in algebraic notation)
[math]\displaystyle{ A3 }[/math] [math]\displaystyle{ S1 \cdot 4 }[/math] piece (for example, 00L0 — white king)
[math]\displaystyle{ A4 }[/math] [math]\displaystyle{ (A2, A3) }[/math] piece on a board (for example L00, 00L; 00L0 — white king on e2)
[math]\displaystyle{ A5 }[/math] [math]\displaystyle{ 64 \times A3 }[/math] board (pieces positions, describes which piece each of 64 squares contains)
[math]\displaystyle{ A10 }[/math] [math]\displaystyle{ (A5, S0, S1 \cdot 4, A2) }[/math] game state ([math]\displaystyle{ A5 }[/math] — board, [math]\displaystyle{ S0 }[/math] — player to move, [math]\displaystyle{ S1 \cdot 4 }[/math] — possibility of castling (2 for white and 2 for black), [math]\displaystyle{ A2 }[/math] — information about cell on which en passant move is possible

Identifiers

Identifiers are alphanumeric characters with a number.[17](p679) There are the following kinds of identifiers for variables:[11](p10)

  • Input values (German: Eingabewerte, Variablen) — marked with a letter V.
  • Intermediate, temporary values (German: Zwischenwerte) — marked with a letter Z.
  • Constants (German: Constanten) — marked with a letter С.
  • Output values (German: Resultatwerte) — marked with a letter R.

Particular variable of some kind is identified by number, written under the kind.[17](p679) For example:

[math]\displaystyle{ \begin{matrix} V \\ 0 \end{matrix} }[/math], [math]\displaystyle{ \begin{matrix} Z \\ 2 \end{matrix} }[/math], [math]\displaystyle{ \begin{matrix} C \\ 31 \end{matrix} }[/math] etc.

Programs and subprograms are marked with a letter P, followed by a program (and optionally a subprogram) number. For example [math]\displaystyle{ P13 }[/math], [math]\displaystyle{ P5 \cdot 7 }[/math].[17](p679)

Output value of program [math]\displaystyle{ P13 }[/math] saved there in variable [math]\displaystyle{ \begin{matrix} R \\ 0 \end{matrix} }[/math] is available for other subprograms under the identifier [math]\displaystyle{ \begin{matrix} R17 \\ 0 \end{matrix} }[/math], and reading value of that variable also means executing related subprogram.[17](p680)

Accessing elements by index

Plankalkül allows access for separate elements of variable by using "component index" (German: Komponenten-Index). When, for example, program receives input in variable [math]\displaystyle{ \begin{matrix} V \\ 0 \end{matrix} }[/math] of type [math]\displaystyle{ A10 }[/math] (game state), then [math]\displaystyle{ \begin{matrix} V \\ 0 \\ 0 \end{matrix} }[/math] — gives board state, [math]\displaystyle{ \begin{matrix} V \\ 0 \\ 0 \cdot i \end{matrix} }[/math] — piece on square number i, and [math]\displaystyle{ \begin{matrix} V \\ 0 \\ 0 \cdot i \cdot j \end{matrix} }[/math] bit number j of that piece.[17](p680)

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).

Two-dimensional syntax

Because indexes of variables are written vertically, each Plankalkül instruction requires multiple rows to write down.[citation needed]

First row contains variable kind, then variable number marked with letter V (German: Variablen-Index), then indexes of variable subcomponents marked with K (German: Komponenten-Index), and then (German: Struktur-Index) marked with S, which describes variable type. Type is not required, but Zuse notes that this helps with reading and understanding the program.[17](p681)

In the line [math]\displaystyle{ S }[/math] types [math]\displaystyle{ S0 }[/math] and [math]\displaystyle{ S1 }[/math] could be shortened to [math]\displaystyle{ 0 }[/math] and [math]\displaystyle{ 1 }[/math].[17](p681)

Examples:

[math]\displaystyle{ \begin{array}{r|l} & V \\ V & 3 \\ K & \\ S & m \times 2 \times 1 \cdot n \end{array} }[/math] variable V3 — list of [math]\displaystyle{ m }[/math] pairs of values of type [math]\displaystyle{ S1 \cdot n }[/math]
[math]\displaystyle{ \begin{array}{r|l} & V \\ V & 3 \\ S & m \times 2 \times 1 \cdot n \end{array} }[/math] Row K could be skipped when it is empty. Therefore, this expression means the same as above.
[math]\displaystyle{ \begin{array}{r|l} & V \\ V & 3 \\ K & i \cdot 0 \cdot 7 \\ S & 0 \end{array} }[/math] Value of eights bit (index 7), of first (index 0) pair, of і-th element of variable V3, has Boolean type ([math]\displaystyle{ S0 }[/math]).

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:

Using variable as index for other variable, in 2d Plankalül notation Z5-th element of variable V3. Equivalent to expression V3[Z5] in many modern programming languages.[17](p681)

Assignment operation

Zuse introduced in his calculus an assignment operator, unknown in mathematics before him. He marked it with «[math]\displaystyle{ \Rightarrow }[/math]», and called it yields-sign (German: Ergibt-Zeichen). Use of concept of assignment is one of the key differences between mathematics and computer science.[8](p14)

Zuse wrote that the expression:

[math]\displaystyle{ \begin{array}{r|lll} & Z + 1 & \Rightarrow & Z\\ V & 1 & & 1\\ \end{array} }[/math]

is analogous to the more traditional mathematical equation:

[math]\displaystyle{ \begin{array}{r|lll} & Z + 1 & = & Z\\ V & 1 & & 1\\ K & i & & i + 1\\ \end{array} }[/math]

There are claims that Konrad Zuse initially used the glyph frameless|25px as a sign for assignment, and started to use [math]\displaystyle{ \Rightarrow }[/math] under the influence of Heinz Rutishauser.[17](p681) Knuth and Pardo believe that Zuse always wrote [math]\displaystyle{ \Rightarrow }[/math], and that frameless|25px was introduced by publishers of «Über den allgemeinen Plankalkül als Mittel zur Formulierung schematisch-kombinativer Aufgaben» in 1948.[8](p14) 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 :=.[17](p681)

The variable that stores the result of an assignment (l-value) is written to the right side of assignment operator.[8](p14) The first assignment to the variable is considered to be a declaration.[17](p681)

The left side of assignment operator is used for an expression (German: Ausdruck), that defines which value will be assigned to the variable. Expressions could use arithmetic operators, Boolean operators, and comparison operators ([math]\displaystyle{ =, \neq, \leq }[/math] etc.).[17](p682)

The exponentiation operation is written similarly to the indexing operation - using lines in the two-dimensional notation:[11](p45)

Exponentiation notation in Plankalkül

Control flow

Boolean values were represented as integers with FALSE=0 and TRUE=1. Conditional control flow took the form of a guarded statement A -> B, which executed the block B if A was true. There was also an iteration operator, of the form W { A -> X; B -> Y} which repeats until all guards are false.[18]

Terminology

Zuse called a single program a Rechenplan ("computation plan"). He envisioned what he called a Planfertigungsgerät ("plan assembly device"), which would automatically translate the mathematical formulation of a program into machine-readable punched film stock, something today would be called a translator or compiler.[4](pp45, 104, 105)

Example

The original notation was two-dimensional.[clarification needed] For a later implementation in the 1990s, a linear notation was developed.

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

See also

References

  1. "Early Programming Languages / CS208e: Great Ideas in Computer Science". Stanford University. https://web.stanford.edu/class/cs208e/cgi-bin/main.cgi/static/lectures/17-ProgrammingEarlyDays/EarlyProgrammingLanguages.pdf.  (46 pages)
  2. The First Computers: History and Architectures. MIT Press. 2002. p. 292. ISBN 978-0-26268137-7. https://books.google.com/books?id=nDWPW9uwZPAC&dq=algol-68+konrad+zuse&pg=PA292. Retrieved 2013-10-25. 
  3. Zenil, Héctor, ed (2012). A Computable Universe: Understanding and Exploring Nature As Computation - with a Foreword by Sir Roger Penrose. Singapore: World Scientific Publishing Company. p. 791. 
  4. Jump up to: 4.0 4.1 4.2 4.3 4.4 4.5 4.6 Hellige, Hans Dieter, ed (January 2004). written at Bremen, Germany (in de). Geschichten der Informatik. Visionen, Paradigmen, Leitmotive (1 ed.). Berlin / Heidelberg, Germany: Springer-Verlag. pp. 45, 56, 89, 104–105, 113, 152, 216–217. doi:10.1007/978-3-642-18631-8. ISBN:3-540-00217-0. ISBN 978-3-540-00217-8.  (xii+514 pages)
  5. Jump up to: 5.0 5.1 5.2 5.3 Hellige, Hans Dieter, ed (January 2004). "Konrad Zuses Plankalkül — Seine Genese und eine moderne Implementierung" (in de). Geschichten der Informatik. Visionen, Paradigmen, Leitmotive. Teil 3: Leitideen und Paradigmen in der Entwicklung der Programmiersprachen und der Programmierung (1 ed.). Berlin / Heidelberg, Germany: Springer-Verlag. pp. 215–235 [2–4]. doi:10.1007/978-3-642-18631-8_9. ISBN 978-3-642-62208-3. http://www.zib.de/zuse/Inhalt/Programme/Plankalkuel/Genese/Genese.pdf.  (21 [24] pages)
  6. "Why is propositional logic not Turing complete?". StackExchange. 2013-04-01. https://math.stackexchange.com/a/348411/571313. 
  7. Cite error: Invalid <ref> tag; no text was provided for refs named {{{1}}}
  8. Jump up to: 8.0 8.1 8.2 8.3 8.4 8.5 "The Early Development of Programming Languages". Stanford University, Computer Science Department. August 1976. pp. 8, 9, 14, 15. https://bitsavers.org/pdf/stanford/cs_techReports/STAN-CS-76-562_EarlyDevelPgmgLang_Aug76.pdf. 
  9. Jump up to: 9.0 9.1 9.2 9.3 "Konrad Zuse's Plankalkül: The First High-Level "non von Neumann" Programming Language". IEEE Annals of the History of Computing (IEEE) 19 (2): 17–24. April–June 1997. doi:10.1109/85.586068. http://doi.ieeecomputersociety.org/10.1109/85.586068.  (8 pages)
  10. (in de) Moderne Rechenkünstler. Die Industrialisierung der Rechentechnik in Deutschland. München, Germany: C.H. Beck Verlag. 1992. 
  11. Jump up to: 11.0 11.1 11.2 (in de) Der Plankalkül (In der Fassung von 1945) (Manuscript). Konrad Zuse Internet Archive. 1946. pp. 10, 45. ZIA ID: 0233. http://zuse.zib.de/item/DB2j_t_w1fbxvaiq. Retrieved 2023-11-01.  (1+1+180 pages)
  12. Hellige, Hans Dieter, ed (January 2004). "Was ist Informatik? Zur Entstehung des Faches an den deutschen Universitäten" (in de). Geschichten der Informatik. Visionen, Paradigmen, Leitmotive. Teil 5: Wandel der Leitkonzepte in der Wissenschaftsdisziplin Informatik (1 ed.). Berlin / Heidelberg, Germany: Springer-Verlag. pp. 473–498 [474]. doi:10.1007/978-3-642-18631-8_17. ISBN:3-540-00217-0. ISBN 978-3-540-00217-8. https://www.researchgate.net/publication/301184912.  [1]
  13. (in de) Der Plankalkül. Kommentierter Nachdruck der Fassung von 1945. 63. Sankt Augustin, Germany: Gesellschaft für Mathematik und Datenverarbeitung (GMD) / Bundesministerium für Bildung und Wissenschaft (BMBW). 1972. BMBW-GMD-63. 
  14. (in de) Der PLANKALKÜL im Vergleich mit algorithmischen Sprachen. Reihe Informatik und Operations Research. 7 (1 ed.). Darmstadt, Germany: S. Toeche-Mittler-Verlag (stmv). 1979. ISBN 3-87820-028-5.  (136 pages) Contents
  15. Description of Plankalkül-Compiler by Wolfgang Mauerer; "Der Plankalkül von Konrad Zuse" (in de). 2016-06-03. http://www.bytesex.de/mauerer/pk/. 
  16. (in de) Konrad Zuses Plankalkül als Vorläufer moderner Programmiermodelle, November 1990 
  17. Jump up to: 17.00 17.01 17.02 17.03 17.04 17.05 17.06 17.07 17.08 17.09 17.10 17.11 17.12 17.13 17.14 17.15 17.16 17.17 "The "Plankalkül" of Konrad Zuse: A Forerunner of Today's Programming Languages" (in en). Communications of the ACM 15 (7): 678–685. 1972. doi:10.1145/361454.361515. http://delivery.acm.org/10.1145/370000/361515/p678-bauer.pdf?key1=361515&key2=3342588511&coll=&dl=acm&CFID=15151515&CFTOKEN=6184618.  (HTML)
  18. "Plankalkül". Encyclopedia of computers and computer history. Chicago / London: Fitzroy Dearborn Publishers. 2001. p. 634. ISBN 1-57958235-4. http://page.mi.fu-berlin.de/rojas/pub/computer_history/m_z/plankalkuel.pdf. Retrieved 26 May 2023. 

Further reading

External links