FOCAL, short for Formulating On-Line Calculations in Algebraic Language, was DEC's answer to a simple wish: sit at the Teletype of a PDP-8, type a formula and get the answer, without punching a program on paper tape, assembling it and loading it. Richard Merrill wrote it at DEC in 1968; FOCAL-69, the version in this room, followed a year later.
It is an interpreter: it reads what you type and does it straight away. Small enough to share the machine's 4,096 words with your own program, it turned a laboratory minicomputer into an interactive calculator and a first programming language for a great many people. The best-known games of the period, Hammurabi and Lunar Lander, were written in it.
Using it
FOCAL has just been loaded and started when you sit down, and its prompt, an asterisk, waits at the ASR-33. A command typed on its own runs at once:
*TYPE 2+2!
*SET A=12; TYPE A*A!
A command that starts with a line number is stored as part of a program
instead. Line numbers come in groups and steps, 1.10, 1.20, 2.10, so a
program falls naturally into parts you can call with DO:
*1.10 ASK "HOW MANY?", N
*1.20 FOR I=1,N; TYPE I, I*I, !
*GO
GO runs the program. WRITE lists it back, and ERASE clears it.
The language
Every command is a word, and every word can be shortened to its first letter,
which is how programs of the time were written to save memory: T for TYPE,
A for ASK, S for SET, I for IF, G for GOTO, D for DO, F
for FOR, Q for QUIT. Numbers are floating point; functions start with F:
FSQT for the square root, FABS, FITR for the integer part, FRAN for a
random number. The ! in TYPE starts a new line.
In the classroom
FOCAL is small enough to learn in an afternoon and old enough to show how interactive computing began: a language designed for a person at a keyboard, not for a batch of cards. Write a short program, then open Lunar Lander or Hammurabi and read how they were built from the same dozen commands.