FOCAL (programming language)

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 with only 4K words of memory and lacking mass storage. The FOCAL interpreter was written in very tight assembly language and typically used only 3K 12-bit words, leaving a somewhat limiting 1K words to hold the user program, and variables.

If the system was upgraded by adding one or more extra 4K banks of memory, FOCAL could use that extra memory, either for a single user, or split the extra memory across several time-sharing users. FOCAL made extensive use of interrupt-driven terminal I/O, so it could keep four teletypes busily whirring with nary a pause.

There was no memory space available to store error messages, so FOCAL used a clever work-around; it reported the address of the error-detecting code as a pseudo floating-point number. For example, the division by zero error was detected by code at address 4333 so the error message was: ?28.73 @ 01.10. Most FOCAL sites had an "error number to error message" listing taped up near the terminals.

Comparisons between FOCAL and BASIC were inevitable since both languages were common on smallish computers of the same era. FOCAL lacked inherent support for strings as data elements which could be assigned to variables. This is generally thought to be a serious deficiency as compared to the string capabilities in most BASICs. This deficiency, while serious, was not as utterly crippling as it might sound. A surprising amount of string usage in FOCAL programs is devoted to formatting user output. Since FOCAL output was character-stream-oriented, outputting two strings sequentially could sometimes substitute for concatenating them, and procedural tools could be written for performing complex formatted output.

A limited amount of string input could be done, so a program could ask simple Yes/No questions, but this was really a kludge. For example, if you typed "HELLO" at an input statement, FOCAL would convert the H to "8", then interpret the "E" as starting an exponent, then it would try to compute "8" to the "LLO" power, which would take several seconds of CPU time and result in a value of 0.76593020E+103, not a particularly helpful response.

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 complex programming tasks than BASIC.

FOCAL's 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 most other low-end programming systems, and made it a reasonable choice for serious numerical work. This high precision, and good choices for default decimal output formatting, meant that difficulties 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, PDP-11 and PDP-12.

The FOCAL manual showed how to add commands to the FOCAL parser, so many sites added specialized commands for operating custom hardware.

The DEC User Society collected many many patches and enhancements for FOCAL. There were even major enhanced offshoots of FOCAL, such as FOCAL-W, which added many features, including better mass storage file I/O and even virtual variable memory!

In Russia, it saw use as late as in early 1990s in mass-produced home computers of the Elektronika BK series.

One cause of FOCAL's decline may have been intellectual-property issues; FOCAL's IP heritage was sufficiently clouded that Digital could not be certain who "owned" it, and this was probably a factor leading to Digital's de-emphasis of the language and failure to continue its development.

ample session with Focal on a PDP15


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

ee also

*MUMPS programming language
*Non-English-based programming languages

External links

* [ DEC's FOCAL 1969 Promotional Booklet]
* [ The Computer History Simulation Project (Focal is available as a free download here)]
* C-source version that runs under several operating systems including Linux
* [ the C-source for a modern DOS version suitable for teaching]

Wikimedia Foundation. 2010.

Look at other dictionaries:

  • FOCAL-69 — was the landmark version of the FOCAL programming language, more widely publicized than the original version of the language created in 1968. FOCAL 69, created by Richard Merrill is important because: * It was the basis for all later derivatives… …   Wikipedia

  • Focal — may refer to:*Focal (lexicographical website), an Irish lexicographical website *FOCAL (programming language) **FOCAL 69 **Focal (HP 41) *Relating to focusee also*Focal point (disambiguation) *Focal adhesion *Focal character *Focal dystonia… …   Wikipedia

  • FOCAL —    Programming language (Digital Equipment) …   IT glossary of terms, acronyms and abbreviations

  • Focal (HP-41) — The Forty one calculator language (Focal) is the language used to program the HP 41 range of expandable science/engineering calculators from Hewlett Packard.As with most other calculator programming languages of the 1980s, a Focal program is a… …   Wikipedia

  • FOCAL (HP-41) — FOCAL ist die am meisten verbreitete Bezeichnung der Programmiersprache für die Taschenrechnerserie HP 41 von Hewlett Packard, die mit dem Modell HP 41C gestartet wurde. FOCAL ist ein Akronym aus Forty One CAlculator Language. FOCAL bietet mehr… …   Deutsch Wikipedia

  • List of programming languages — Programming language lists Alphabetical Categorical Chronological Generational The aim of this list of programming languages is to include all notable programming languages in existence, both those in current use and historical ones, in… …   Wikipedia

  • Non-English-based programming languages — are computer programming languages that, unlike better known programming languages, do not use keywords taken from, or inspired by, the English vocabulary. Contents 1 Prevalence of English based programming languages 2 International programming… …   Wikipedia

  • Comment (computer programming) — For comments in Wikipedia markup, see Help:Wiki markup#Character formatting and WP:COMMENT. An illustration of Java source code with prologue comments indicated in red and inline comments in green. Program code is in blue …   Wikipedia

  • Generational list of programming languages — Here, a genealogy of programming languages is shown. Languages are categorized under the ancestor language with the strongest influence. Of course, any such categorization has a large arbitrary element, since programming languages often… …   Wikipedia

  • Non-structured programming — Programming paradigms Agent oriented Automata based Component based Flow based Pipelined Concatenative Concurrent computing …   Wikipedia