Introduction to PingPong

Overview

PingPong is an interpreted two dimensional language based on "Befunge". It is not intended to create useful programs but just to experiment with an unusual programming concept. But theoretically it is possible to code any algorithm in PingPong since it is turing-complete (see Turing-Completeness).

"2D-language" means that the instruction pointer can move through a two-dimensional array in any direction (up, down, left, right) and you can change its direction by special commands. This array (or PingPong-space) is virtually 4 gigs * 4 gigs large and contains the executed code. You can also read/write from/to the PingPong-space and use it as your program's memory, allowing self-modifying code. This is the main reason why it is very hard or even impossible to compile a PingPong program.

PingPong operates on a stack and executes programs in postfix notation. Almost all non-alphanumeric characters on my german keyboard are instructions and all other characters are just pushed onto the stack. I think there are three instructions which can't be found on US-keyboards: "°" (degree-sign) with character code #176, "§" (section-sign) with character code #167 and "¤" (currency-symbol) with character code #164

The name "PingPong" is inspired by the movement of the instruction pointer when executing a program like the following: "#| |". The instructions pointer (imagine a ball) hits the "|" and gets reflected, then it hits the other "|" and gets reflected again, just as if those characters were PingPong-rackets.

The End of Apartheid

Quote from The History of Apartheid in South Africa:
[...] With the enactment of apartheid laws in 1948, racial discrimination was institutionalized. Race laws touched every aspect of social life, including a prohibition of marriage between non-whites and whites, and the sanctioning of "white-only" jobs. In 1950, the Population Registration Act required that all South Africans be racially classified into one of three categories: white, black (African), or colored (of mixed decent). The coloured category included major subgroups of Indians and Asians. Classification into these categories was based on appearance, social acceptance, and descent. [...] The Department of Home Affairs (a government bureau) was responsible for the classification of the citizenry. Non-compliance with the race laws were dealt with harshly. [...]

As you may have noticed, racial discrimination is not only a South African problem. Also in computing science we can see the same scheme being applied in the so called "high level languages". Here code and data are separated even more strictly than blacks and whites were separated in South Africa. But who gives those racist languages the right to just prohibit data from being executed or to prohibit code from being processed or altered? History has shown that such concepts will never work well or for a long period of time.

PingPong, amongst others, is a language where code and data are equal. It is even wrong to talk about them in different terms (maybe we should say "cota").

Befunge

This language is based on Befunge's concept of two dimensionality. I decided to create it after I took a not-so-close look at Befunge because there were some details I didn't like. You will notice the differences when you read the tutorial or the language reference.

Download

The file contains the source code of the interpreter and the debugger, the compiled classes, some examples, and a wordfile for UltraEdit.

Note that the current implementation does not yet support the use of multiple PingPong-Spaces as it is described in the tutorial, but you won't use them unless you try to create a big application in PingPong (not so likely anyway). The debugger is mainly a tool for visualizing the control flow. In the future I will add some advanced features like breakpoints, stack editing, etc.

Download PingPong

Further Reading

Continue with the Tutorial.

©2001, Michael Wurm. Legals