FOCAL programming language
Encyclopedia : F : FO : FOC : FOCAL programming language
FOCAL, (abbreviation of FOrmula CALculator), is an interpreted programming language resembling JOSS.
Largely the creation of Richard Merrill, FOCAL was initially written for and had its largest impact on the Digital Equipment Corporation's (DEC's) PDP-8 computers. Merrill wrote the original (1968) and classic FOCAL-69 interpreters for the PDP-8. Digital itself described FOCAL as "a JOSS-like language."
Like early versions of BASIC, FOCAL was a complete programming environment in itself, requiring no operating system. As in MUMPS, most commands could be, and in practice were, abbreviated to a single letter of the alphabet. Creative choices of words were used to make each command uniquely defined by its leading character. Digital made available several European-language versions in which the command words were translated into the target language.
FOCAL ran on very low-end PDP-8 systems, even systems lacking mass storage. Multiuser FOCAL systems, running on quite small systems, could drive up to four teletypes and serve four users simultaneously.
Comparisons between FOCAL and BASIC are inevitable. FOCAL lacked support for strings as data elements that could be assigned to variables, a major deficiency vis-a-vis BASIC. This deficiency, while serious, was not as utterly crippling as it might sound. A surprising amount of string usage in programs is devoted to formatting user output. Since FOCAL output was character-stream-oriented, outputting two strings sequentially could sometime substitute for concatenating them, and procedural tools could be written to performing complex formatted output.
It is generally agreed that FOCAL was more efficient in its use of resources than comparable BASIC systems; on a typical machine of the day (often with 6 to 24 kilobytes of core memory), FOCAL could handle larger and more difficult programming tasks than BASIC.
FOCAL's traditional PDP-8 implementation used a floating point representation that represented numbers as four 12-bit words, with thirty-six bits of mantissa and twelve bits of exponent. This allowed for both significantly higher precision and a significantly wider range of values than other low-end programming systems, and made it reasonably suitable for numerical work. The high precision, and good choices for default decimal output formatting, meant that issues with binary-to-decimal rounding were not evident to beginning users.
The Coca-Cola Corporation used a customized version of FOCAL called COKE.
FOCAL was later implemented on the PDP-7/9 and PDP-11.
One cause of FOCAL's decline may have been intellectual-property issues; FOCAL's IP heritage was sufficiently cloudy that Digital could not be certain who "owned" it, and this was probably a factor leading to Digital de-emphasizing it and failing to continue development of the language.
Sample Session with Focal on a PDP15
FOCAL15 V6B *01.10 ASK "IN WHAT YEAR WERE YOU BORN?", YEAR *01.20 SET YEAROFFOCAL=YEAR-1969+1 *01.30 IF (YEAROFFOCAL) 02.10,02.10,01.40 *01.40 TYPE "YOU WERE BORN IN THE YEAR ",YEAROFFOCAL," OF FOCAL!",! *01.50 GOTO 01.10 *02.10 TYPE "YOU ARE TOO OLD FOR FOCAL, POPS",! *02.20 GOTO 01.10 *GO IN WHAT YEAR WERE YOU BORN?:1969 YOU WERE BORN IN THE YEAR 1.0000 OF FOCAL! IN WHAT YEAR WERE YOU BORN?:1950 YOU ARE TOO OLD FOR FOCAL, POPS IN WHAT YEAR WERE YOU BORN?:
This program takes your year of birth and calculates what year A.F. (after Focal) you were born in.
Program lines in a Focal program are grouped into linegroups and line numbers within that group. The first line of the program line 01.10 is line 10 of group 01. The line numbers are the targets of the GOTO and the IF statements.
The ASK statement prompts on the attached teletype for input, while the TYPE statement outputs text on the teletype. Multiple items can be output to the teletype by appending each item after a comma. An exclamation mark (!) causes a linefeed and carriage return to be sent.
The SET statement assigns a value to a variable. This value can be the result of an expression.
The conditional IF statement can receive up to three line numbers as parameters. The program branches to the first linenumber if the result of the expression in parenthesis is less than zero, to the second if the result is zero and to the third if the result is above zero
On the GO command, Focal begins to run the program.
Focal prompts with a single asterisk (*) at the beginning of the line when it is expecting input.
See also
External links
- [DEC's FOCAL 1969 Promotional Booklet]
- [The Computer History Simulation Project (Focal is available as a free download here)]
From Wikipedia, the Free Encyclopedia. Original article here. Support Wikipedia by contributing or donating.
All text is available under the terms of the GNU Free Documentation License See Wikipedia Copyrights for details.
