Crazydev
Raiting:
3

The first high-level programming language - Plankalkül


Plankalkül (Plan Calculus) is first high-level programming language in the world designed for engineering purposes by Konrad Zuse between 1943 and 1946 for his computer Z4 (the picture of computer is below, taken from "Wikipedia").

image

There was the World War II; Zuse worked in isolation from the scientists of other countries, quite independently. During this time he had created not only a programming language, but also he wrote 49 pages of programs for evaluating chess positions using this language. All his work was eventually more comprehensively published in 1972.

We would try to take a look at this programming language as the archaeological survey and give a brief overview of the important language aspects.

The next high-level language “Fortran” appeared only in 1957 (the work was begun in 1954).

Z4 was electro-mechanical, so the Plankalkül’s compiler or interpreter did not exist for that, but in 2000 the Free University of Berlin created the interpreter of its dialect (it runs as a Java applet in a browser).

Dialect that is being implemented called Plankalkül-2000 and differentiates by a simplified form of writing programs. For example, as a simplified form of writing Zuse used a two-dimensional layout, namely the form was written as a first line, and below some of its arguments (the variable type, indexes and so on). In addition, the operation signs have been simplified and
made more familiar to us.

Language is fairly rich as for forties: it has a conditional structure, two types of cycles (similar to “while” and “for”), as well there are arrays and tuples, and it allows defining and calling subprograms (but there is no recursion).

All variables are divided into four types.

• "Variablen" (Input variables) - V variables, numbered V0, V1, etc., which are read-only.
• "Zwischenwert" (Intermediate values) - Z variables, numbered Z0, Z1, etc., which can be read and written.
• "Resultatwerte" (Result) - R variables, numbered R0, R1, etc., which are write-only.
• "Indizes" (Index) - Loop variables (similar to “for”), starting with «i», which are used in loops. They are denoted i0, i1, i2, etc., according to the depth of loop nesting, and are of generic numeric type.

All variables have a "structure" or type. The following data types are possible:

• One bit, denoted as "0"
• n bits, where n is an integer, denoted "n.0"
• Tuples of other types. For example (3.0,4.0) denotes a pair of variables, one of 3 bits, the second of 4 bits. Tuples can have two or more elements.
• m times any other type, for example 4.5.0, which denotes an array of five elements, each one of five bits.

Some examples of possible data types are:

• 8.0 a byte
• 16.8.0 a vector of 16 bytes
• (0, 8.0, 16.0) a triple formed of one bit, 8 bits, and 16 bits
• 32.(0, 8.0, 16.0) an array of 32 triads with the structure above

Plankalkül syntax obviously can be greatly simplified, but the modern dialect exactly copies that writing, which was used by Zuse, However, the language itself is quite simple and it could be learned for 15 minutes.

Here is an example that calculates the specified (in order) Fibonacci number:

P0 FactEvgenyStepanischev (V0[:4.0]) => (R0[:10.0])
(0, 1) => (Z0[:10.0], Z1[:10.0])

W1 (V0[:4.0]) [
i > 0 -> (Z0[:10.0] + Z1[:10.0], Z1[:10.0] - Z0[:10.0]) => (Z1[:10.0], Z0[:10.0])
]

Z1[:10.0] => R0[:10.0]

END


It should be run as follows: open the page with the interpreter, copy it to this program window, press the “Compile”, then it opens a separate window with Java applets (it requires that a computer will have an installed Java), using a mouse type bit by bit the initial value V0 in open window (click on the green circles), then click “Run” in browser window, and you will see in a red line (R0) the resulting value.

image

Language subprogram begins with the “P” and a unique number, and then comes the name by which it can be called, the subprogram name will be “FactEvgenyStepanischev”, and it ends with a keyword “END” (the original Plankalkül did not have that).

The subprogram defines the received and returned values. The first line binds values "zero" and "one" and the intermediate variables get Z0 and Z1. Type of variables must be specified each time they used, and a variable cannot be converted to another type.

Loop “for” (W1) goes below, used the loop variable «i» without a number. In the parentheses is specified the number of repetitions, and the following square brackets specifies the body of the loop. More details could be found in the description.

The operation "arrow" („->“) – conditional structure, the right part will be executed if the form on the left is true. The dialect uses only the simplest forms, such as
loop.

Here is used a comprehensive assignment statement set that is familiar to those who use Perl, Python, or PHP, but it works differently – the assignment statement sets are being executed sequentially from left to right “(Z0 [: 10.0] + Z1 [: 10.0], Z1 [: 10.0]) => (Z1 [: 10.0], Z0 [: 10.0])”, the result is not going to be one that is expected.

There is assigned an intermediate value to the resulting value of subprogram at the end.

It does not make sense to define separately the referencing array elements, function call, and the “while” loop, because they look quite natural in this syntax.
All operations that are supported by the language, such as logical operations, bit operations, and four arithmetic operations look familiar.
Pirat 11 december 2011, 14:27
Vote for this post
Bring it to the Main Page
 

Comments

Leave a Reply

B
I
U
S
Help
Avaible tags
  • <b>...</b>highlighting important text on the page in bold
  • <i>..</i>highlighting important text on the page in italic
  • <u>...</u>allocated with tag <u> text shownas underlined
  • <s>...</s>allocated with tag <s> text shown as strikethrough
  • <sup>...</sup>, <sub>...</sub>text in the tag <sup> appears as a superscript, <sub> - subscript
  • <blockquote>...</blockquote>For  highlight citation, use the tag <blockquote>
  • <code lang="lang">...</code>highlighting the program code (supported by bash, cpp, cs, css, xml, html, java, javascript, lisp, lua, php, perl, python, ruby, sql, scala, text)
  • <a href="http://...">...</a>link, specify the desired Internet address in the href attribute
  • <img src="http://..." alt="text" />specify the full path of image in the src attribute