Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Plankalkül
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Description== Plankalkül has drawn comparisons to the language [[APL (programming language)|APL]], and to [[relational algebra]]. It includes assignment statements, [[subroutine]]s, 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 (abstract data type)|graph]]'' ({{lang|de|verallgemeinerter Graph}}), which can be used to represent geometrical structures.<ref name="Giloi_1990"/> 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:<ref name="Hellige_2004"/>{{rp|page=217}} * 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 [[binary digit|bit]] or [[Boolean data type|Boolean]] ({{langx|de|Ja-Nein-Werte}} – yes-no value in Zuse's terminology). It is denoted by the identifier <math>S0</math>. All the further data types are composite, and build up from primitive by means of "arrays" and "records".<ref name="Bauer-Wössner_1972"/>{{rp|page=679}} So, a sequence of eight bits (which in modern computing could be regarded as [[byte]]) is denoted by <math>8 \times S0</math>, and Boolean matrix of size <math>m</math> by <math>n</math> is described by <math>m \times n \times S0</math>. There also exists a shortened notation, so one could write <math>S1 \cdot n</math> instead of <math>n \times S0</math>.<ref name="Bauer-Wössner_1972"/>{{rp|page=679}} Type <math>S0</math> could have two possible values <math>0</math> and <math>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.<ref name="Bauer-Wössner_1972"/>{{rp|page=679}} Record of two components <math>\sigma</math> and <math>\tau</math> is written as <math>(\sigma, \tau)</math>.<ref name="Bauer-Wössner_1972"/>{{rp|page=679}} Type ({{langx|de|Art}}) in Plankalkül consists of 3 elements: structured value ({{langx|de|Struktur}}), pragmatic meaning ({{langx|de|Typ}}) and possible restriction on possible values ({{langx|de|Beschränkung}}).<ref name="Bauer-Wössner_1972"/>{{rp|page=679}} User defined types are identified by letter A with number, like <math>A1</math> – first user defined type. ====Examples==== Zuse used a lot of examples from chess theory:<ref name="Bauer-Wössner_1972"/>{{rp|page=680}} {|cellpadding=5 style="border:1px solid #BBB; width:800px;" |- | <math>A1</math> | <math>S1 \cdot 3</math> | Coordinate of chess board (it has size 8x8 so 3 bits are just enough) |- | <math>A2</math> | <math>2 \times A1</math> | square of the board (for example L00, 00L denotes e2 in [[Algebraic notation (chess)|algebraic notation]]) |- | <math>A3</math> | <math>S1 \cdot 4</math> | piece (for example, 00L0 — white king) |- | <math>A4</math> | <math>(A2, A3)</math> | piece on a board (for example L00, 00L; 00L0 — white king on e2) |- | <math>A5</math> | <math>64 \times A3</math> | board (pieces positions, describes which piece each of 64 squares contains) |- | <math>A10</math> | <math>(A5, S0, S1 \cdot 4, A2)</math> | game state (<math>A5</math> — board, <math>S0</math> — player to move, <math>S1 \cdot 4</math> — possibility of [[castling]] (2 for white and 2 for black), <math>A2</math> — information about cell on which ''[[en passant]]'' move is possible |} ===Identifiers=== Identifiers are alphanumeric characters with a number.<ref name="Bauer-Wössner_1972"/>{{rp|page=679}} There are the following kinds of identifiers for variables:<ref name="Zuse_1945"/>{{rp|page=10}} * Input values ({{langx|de|Eingabewerte, Variablen}}) — marked with a letter V. * Intermediate, temporary values ({{langx|de|Zwischenwerte}}) — marked with a letter Z. * Constants ({{langx|de|Constanten}}) — marked with a letter С. * Output values ({{langx|de|Resultatwerte}}) — marked with a letter R. Particular variable of some kind is identified by number, written under the kind.<ref name="Bauer-Wössner_1972"/>{{rp|page=679}} For example: : <math>\begin{matrix} V \\ 0 \end{matrix}</math>, <math>\begin{matrix} Z \\ 2 \end{matrix}</math>, <math>\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>P13</math>, <math>P5 \cdot 7</math>.<ref name="Bauer-Wössner_1972"/>{{rp|page=679}} Output value of program <math>P13</math> saved there in variable <math>\begin{matrix} R \\ 0 \end{matrix}</math> is available for other subprograms under the identifier <math>\begin{matrix} R17 \\ 0 \end{matrix}</math>, and reading value of that variable also means executing related subprogram.<ref name="Bauer-Wössner_1972"/>{{rp|page=680}} ===Accessing elements by index=== Plankalkül allows access for separate elements of variable by using "component index" ({{langx|de|Komponenten-Index}}). When, for example, program receives input in variable <math>\begin{matrix} V \\ 0 \end{matrix}</math> of type <math>A10</math> (game state), then <math>\begin{matrix} V \\ 0 \\ 0 \end{matrix}</math> — gives board state, <math>\begin{matrix} V \\ 0 \\ 0 \cdot i \end{matrix}</math> — piece on square number i, and <math>\begin{matrix} V \\ 0 \\ 0 \cdot i \cdot j \end{matrix}</math> bit number j of that piece.<ref name="Bauer-Wössner_1972"/>{{rp|page=680}} In modern programming languages, that would be described by notation similar to <code>V0[0]</code>, <code>V0[0][i]</code>, <code>V0[0][i][j]</code> (although to access a single bit in modern programming languages a [[mask (computing)|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|date=November 2016}} First row contains variable kind, then variable number marked with letter V ({{langx|de|Variablen-Index}}), then indexes of variable subcomponents marked with K ({{langx|de|Komponenten-Index}}), and then ({{langx|de|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.<ref name="Bauer-Wössner_1972"/>{{rp|page=681}} In the line <math>S</math> types <math>S0</math> and <math>S1</math> could be shortened to <math>0</math> and <math>1</math>.<ref name="Bauer-Wössner_1972"/>{{rp|page=681}} Examples: {|cellpadding=5 style="border:1px solid #BBB; width:600px;" |- | <math>\begin{array}{r|l} & V \\ V & 3 \\ K & \\ S & m \times 2 \times 1 \cdot n \end{array}</math> | variable V3 — list of <math>m</math> pairs of values of type <math>S1 \cdot n</math> |- | <math>\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>\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>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: {|cellpadding=5 style="border:1px solid #BBB; width:600px;" |- | [[File:Plankalkül variable index.png|Using variable as index for other variable, in 2d Plankalül notation]] | Z5-th element of variable V3. Equivalent to expression <code>V3[Z5]</code> in many modern programming languages.<ref name="Bauer-Wössner_1972"/>{{rp|page=681}} |} ===Assignment operation=== Zuse introduced in his calculus an assignment operator, unknown in mathematics before him. He marked it with «<math>\Rightarrow</math>», and called it yields-sign ({{langx|de|Ergibt-Zeichen}}). Use of concept of assignment is one of the key differences between mathematics and computer science.<ref name="Knuth-Pardo_1976"/>{{rp|page=14}} Zuse wrote that the expression: : <math>\begin{array}{r|lll} & Z + 1 & \Rightarrow & Z\\ V & 1 & & 1\\ \end{array}</math> is analogous to the more traditional mathematical equation: : <math>\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 [[File:Ergibt-Zeichen.png|frameless|25px]] as a sign for assignment, and started to use <math>\Rightarrow</math> under the influence of [[Heinz Rutishauser]].<ref name="Bauer-Wössner_1972"/>{{rp|page=681}} Knuth and Pardo believe that Zuse always wrote <math>\Rightarrow</math>, and that [[File:Ergibt-Zeichen.png|frameless|25px]] was introduced by publishers of «Über den allgemeinen Plankalkül als Mittel zur Formulierung schematisch-kombinativer Aufgaben» in 1948.<ref name="Knuth-Pardo_1976"/>{{rp|page=14}} 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 <code>:=</code>.<ref name="Bauer-Wössner_1972"/>{{rp|page=681}} The variable that stores the result of an assignment ([[L-value (computer science)|l-value]]) is written to the right side of assignment operator.<ref name="Knuth-Pardo_1976"/>{{rp|page=14}} The first assignment to the variable is considered to be a declaration.<ref name="Bauer-Wössner_1972"/>{{rp|page=681}} The left side of assignment operator is used for an expression ({{langx|de|Ausdruck}}), that defines which value will be assigned to the variable. Expressions could use arithmetic operators, Boolean operators, and comparison operators (<math>=, \neq, \leq</math> etc.).<ref name="Bauer-Wössner_1972"/>{{rp|page=682}} The exponentiation operation is written similarly to the indexing operation - using lines in the two-dimensional notation:<ref name="Zuse_1945"/>{{rp|page=45}} [[File:Plankalkül-Potenzen.png|Exponentiation notation in Plankalkül]] ===Control flow=== Boolean values were represented as integers with {{code|1=FALSE=0}} and {{code|1=TRUE=1}}. Conditional control flow took the form of a guarded statement {{code|A -> B}}, which executed the block {{code|B}} if {{code|A}} was true. There was also an iteration operator, of the form {{code|W { A -> X; B -> Y }}} which repeats until all guards are false.<ref name="Rojas_2001"/> ===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 (computing)|translator]] or [[compiler]].<ref name="Hellige_2004"/>{{rp|pages=45, 104, 105}} ===Example=== The original notation was two-dimensional, i.e. the indentation and thus spatial relation of different terminal symbols mattered in regard to the semantics ''spanning multiple lines''. For a later implementation in the 1990s, a linear notation was developed. The following example defines a function <code>max3</code> (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
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)