GEORGE (programming language)
GEORGE (General Order Generator) is a programming language invented by Charles Leonard Hamblin in 1957.[1][2][3][4] It was designed around a push-down pop-up stack for arithmetic operations, and employed reverse Polish notation.[5] The language included loops, subroutines, conditionals, vectors, and matrices.
Description
Algebraic expressions were written in reverse Polish notation; thus, [math]\displaystyle{ a + b }[/math] was written a b +
, and similarly for the other arithmetic operations of subtraction, multiplication, and division.
The algebraic expression [math]\displaystyle{ ax^2 + bx + c }[/math] was written a x dup × × b x × + c +
, where 'dup
' meant 'duplicate the value'.
Following the reverse Polish form, an assignment statement to evaluate the formula [math]\displaystyle{ y = ax^2 + bx + c }[/math] was written as a x dup × × b x × + c + (y)
.
The computer evaluated the expression as follows: the values of a
, then x
, were pushed onto the top of the accumulator stack; 'dup
' caused a copy of the top-most value (x
) to be pushed onto the top of the accumulator stack; Multiply (×
) caused the top two values, namely, x
and x
, to be removed (popped) and multiplied, returning the product to the top of the accumulator stack. The second multiply (×
) then caused the top two values on the stack (namely, a
and x**2
) to be popped and multiplied, and the product (a×x**2
) to be pushed onto the top of the accumulator stack. And so on the remaining components of the expression. The final operation, namely (y
), returned the value of the expression to storage without changing the status of the accumulator stack.
Assuming that the value on the top of the accumulator stack was not required immediately, it would be removed (cleared) by using the operator (;
).
The following program reads in eight values and forms their sum:
0, 1, 8 rep (j) R + ] (P)
- The first line initialises the sum by pushing the value zero onto the top of the accumulator stack.
- The second line introduces a loop, is spoken as "for 1 to 8 repeat for j", and is terminated by the square bracket.
- In the third line, R causes one number to be read in and pushed onto the top of the accumulator stack, and the plus sign (+) causes that value to be added to the (partial) sum, leaving only the partial sum on the top of the accumulator stack.
- After the loop terminates, the (P) causes the final sum to be punched on a card.
Manipulation of vectors and matrices requires subscript notation. In GEORGE, the subscript(s) preceded the vector or matrix name. Thus A(j) was written j | A
.
The following program reads in vector a of 10 values, then forms the squares of those values, and finally prints those values.
1, 10 R1 (a) 1, 10 rep (j) j | a dup * j | (a) ; ] 1, 10 P1 (a)
- In the program, the first line is a vector read that reads in the ten values into a(1) through a(10).
- The second line introduces a loop to run through the ten values of j.
- The third line fetches a(j), duplicates it, multiplies those two values giving the square, and then stores it in a(j). Note the semicolon (;), which clears (or cancels) the top entry in the accumulator stack. Were this not done, the accumulator would gradually fill up with the squares of the values.
- The final line is a vector punch (i.e., print) to write out the ten squares.
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 15 | ||
---|---|---|---|---|---|---|---|---|---|---|
0 | / | 0 | 16 | a | q | (a) | (q) | log | R | |
1 | , | // | 1 | 17 | b | r | (b) | (r) | exp | (P) |
2 | ; | ~ | 2 | 18 | c | s | (c) | (s) | pow | |
3 | * | & | 3 | 19 | d | t | (d) | (t) | rem | |
4 | ∨ | 4 | 20 | e | u | (e) | (u) | sqrt | ||
5 | + | ] | 5 | 21 | f | v | (f) | (v) | sin | |
6 | - | ↓ | 6 | 22 | g | w | (g) | (w) | cos | |
7 | × | ↑ | 7 | 23 | h | x | (h) | (x) | ||
8 | ÷ | rep | 8 | 24 | i | y | (i) | (y) | R1 | |
9 | neg | I | 9 | 25 | j | z | (j) | (z) | P1 | |
10 | mod | 10 | 26 | k | α | (k) | (α) | R11 | ||
11 | max | 11 | 27 | l | β | (l) | (β) | P11 | ||
12 | dup | 12 | 28 | m | γ | (m) | (γ) | |||
13 | rev | 13 | 29 | n | λ | (n) | (λ) | |||
14 | = | 14 | 30 | Θ | μ | (Θ) | (μ) | |||
15 | > | 15 | 31 | p | ω | (p) | (ω) |
The above GEORGE coding table assisted in transcribing a program onto punch cards.
Conditional operations were written as jumps, as follows: if a > 0 go to 5 (which transfers to label 5 if a is greater than zero) would be written
0 a > 5 ↑
Label 5 was indicated by including *5 elsewhere in the program. Unconditional transfers were written 5↑
Subroutine calls were made with the down arrow, .g., to call subroutine labelled 17, write 17↓, where the label 17 was encoded using column 3 of the above table.
Historical note
In the first version running by May 1957 on an English Electric DEUCE, all values were stored in binary fixed-point form in a 32-bit word, with 16 binary places.
In the second version introduced by 1958, values were held in floating-point form, with one value per word: 22 bits for the mantissa and 10 bits for the exponent.
Some form of coding table was needed because the printing equipment of the time provided only 26 letters of the alphabet, a decimal point, plus sign, minus sign, and slash.
References
- ↑ An Addressless Coding Scheme based on Mathematical Notation (Typescript). New South Wales University of Technology. May 1957.
- ↑ "An addressless coding scheme based on mathematical notation". Proceedings of the First Australian Conference on Computing and Data Processing (Salisbury, South Australia: Weapons Research Establishment). June 1957.
- ↑ "Computer Languages". The Australian Journal of Science (20?): 135–139. 1957; "Computer Languages". The Australian Computer Journal 17 (4): 195–198. November 1985.
- ↑ GEORGE IA and II: A semi-translation programming scheme for DEUCE: Programming and Operation Manual. School of Humanities, University of New South Wales, Kensington, New South Wales. 1958. http://members.iinet.net.au/~dgreen/deuce/GEORGEProgrammingManual.pdf. Retrieved 2020-07-27.
- ↑ "The KDF9 Computer — 30 Years On". Resurrection - The Bulletin of the Computer Conservation Society (Computer Conservation Society (CCS)) (18): 7–15. Autumn 1997. ISSN 0958-7403. http://www.cs.man.ac.uk/CCS/Archive/Resurrection/pdf/res18.pdf. Retrieved 2020-07-27. "[…] The KDF9 is remarkable because it is the believed to be the first zero-address instruction format computer to have been announced (in 1960). It was first delivered at about the same time (early 1963) as the other famous zero-address computer, the Burroughs B5000 in America. Like many modern pocket calculators, a zero-address machine allows the use of Reverse Polish arithmetic; this offers certain advantages to compiler writers. It is believed that the attention of the English Electric team was first drawn to the zero-address concept through contact with George (General Order Generator), an autocode programming system written for a Deuce computer by the University of Sydney, Australia, in the latter half of the 1950s. George used Reversed Polish, and the KDF9 team were attracted to this convention for the pragmatic reason of wishing to enhance performance by minimising accesses to main store. This may be contrasted with the more `theoretical' line taken independently by Burroughs. Besides a hardware nesting store or stack - the basic mechanism of a zero-address computer - the KDF9 had other groups of central registers for improving performance which gave it an interesting internal structure. […]". [1] (NB. This is an edited version of a talk given to North West Group of the Society at the Museum of Science and Industry, Manchester, UK on 1996-10-01.)
- ↑ Programming Course. School of Electrical Engineering, The University of New South Wales. n.d.. p. 24.
Original source: https://en.wikipedia.org/wiki/GEORGE (programming language).
Read more |