OU blog

Personal Blogs

Richard Walker

Plankalcül, an early programming language

Visible to anyone in the world
Edited by Richard Walker, Monday, 14 Dec 2009, 00:29

Plankalkül

The first high-level programming language was Plankalkül, published in 1948 by the German inventor Konrad Zuse.

This language was very advanced for its time and already displayed many of the same structures we see today. Below is a sample program, followed by a working equivalent in JavaScript.

The program is not at all hard to follow. The only somewhat obscure part is in the declarations e.g. V0[:8.0], where the :8.0 seems to be reserving memory space for an integer represented in 8 bits.

<SCRIPT LANGUAGE=JAVASCRIPT>

/* Plankalkul example from Konrad Zuse
Original code:
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 http://en.wikipedia.org/wiki/Plankalkcül

JavaScript equivalent follows
*/

function max3(v0, v1, v2)
{
var z1;
z1 = max(v0, v1);
z1 = max(z1, v2);
return z1;
}

function max(v0, v1)
{
var z1;
z1 = v0;
if (z1 < v1)
{
z1 = v1;
}
return z1;
}

// Try functions out
document.write('The maximum of 2, 3 and 1 is ' + max(2, 3, 1));

</SCRIPT>

 

Permalink
Share post

This blog might contain posts that are only visible to logged-in users, or where only logged-in users can comment. If you have an account on the system, please log in for full access.

Total visits to this blog: 2371460