GEORGE (programming language)


GEORGE is a programming language invented by Charles Leonard Hamblin in 1957.
It was designed around a push-down pop-up stack for arithmetic operations, and employed reverse Polish notation.
The language included loops, subroutines, conditionals, vectors, and matrices.
Algebraic expressions were written in reverse Polish notation; thus, was written a b +, and similarly for the other arithmetic operations of subtraction, multiplication, and division.
The algebraic expression 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 was written as a x dup × × b x × + c + .
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 to be pushed onto the top of the accumulator stack; Multiply caused the top two values, namely, x and x, to be removed and multiplied, returning the product to the top of the accumulator stack. The second multiply then caused the top two values on the stack to be popped and multiplied, and the product to be pushed onto the top of the accumulator stack. And so on the remaining components of the expression. The final operation, namely, 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 by using the operator.
The following program reads in eight values and forms their sum:

0,
1, 8 rep
R +

Manipulation of vectors and matrices requires subscript notation. In GEORGE, the subscript preceded the vector or matrix name. Thus A 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
1, 10 rep
j | a dup * j | ;
1, 10 P1

1234567815-
0/016aqlogR
1,//117brexp
2;~218cspow
3*&319dtrem
4420eusqrt
5+]521fvsin
6-622gwcos
7×723hx
8÷rep824iyR1
9negI925jzP1
10mod1026kαR11
11max1127lβP11
12dup1228mγ
13rev1329nλ
14=1430Θμ
15>1531pω

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
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.