Difference between revisions of "FOCAL"

From Computer History Wiki
Jump to: navigation, search
m (very similar)
(Cover basic syntax)
Line 1: Line 1:
 
'''FOCAL''' was an early [[interpreter|interpreted]] [[programming language]], very similar to [[BASIC]], produced by [[Digital Equipment Corporation|DEC]] for use on smaller computers such as the [[PDP-8]].
 
'''FOCAL''' was an early [[interpreter|interpreted]] [[programming language]], very similar to [[BASIC]], produced by [[Digital Equipment Corporation|DEC]] for use on smaller computers such as the [[PDP-8]].
  
{{stub}}
+
The [[syntax]] of FOCAL is very similar to that of BASIC; every [[statement]] has a line number. Statements can be entered in any order, but they will be [[execute]]d in numerical order. One difference is that BASIC line numbers are integers, but FOCAL line numbers are in two parts (looking rather like [[floating point]] numbers). This allows groups of lines to be treated as an entity, e.g. for [[subroutine]]s.
 +
 
 +
[[Conditional]] statements ('IF') include an [[expression]], and three lines numbers. If the expression's value is less than zero, the first statement is executed; if zero, the second; or if greater than zero, the third. The second and third lines numbers are optional. [[Loop]]s ('FOR') are also available.
 +
 
 +
[[Variable]] names are one or two characters long, of which the first must be a letter (other than 'F'). Values are always floating point. [[Array]]s are available.
 +
 
 +
A [[subroutine package|library]] of trigonometric [[function]]s is standard.
 +
 
 +
{{semi-stub}}
  
 
==External links==
 
==External links==

Revision as of 07:16, 12 May 2023

FOCAL was an early interpreted programming language, very similar to BASIC, produced by DEC for use on smaller computers such as the PDP-8.

The syntax of FOCAL is very similar to that of BASIC; every statement has a line number. Statements can be entered in any order, but they will be executed in numerical order. One difference is that BASIC line numbers are integers, but FOCAL line numbers are in two parts (looking rather like floating point numbers). This allows groups of lines to be treated as an entity, e.g. for subroutines.

Conditional statements ('IF') include an expression, and three lines numbers. If the expression's value is less than zero, the first statement is executed; if zero, the second; or if greater than zero, the third. The second and third lines numbers are optional. Loops ('FOR') are also available.

Variable names are one or two characters long, of which the first must be a letter (other than 'F'). Values are always floating point. Arrays are available.

A library of trigonometric functions is standard.

External links