Page:Forth Dimensions Volume 01 Number 2.pdf/2

From Wikisource
Jump to navigation Jump to search
This page needs to be proofread.

HISTORICAL PERSPECTIVE

FORTH was created by Mr, Charles H. Moore in about 1969 at the National Radio Astronomy Observatory, Charlottesville, VA. It was created out of his dissatisfaction with available programming tools, especially for automation. Distribution of his work to other observatories has made FORTH the de-facto standard language for observatory automation.

Mr. Moore and several associates formed Forth Inc. in 1973 for the purpose of licensing and support the FORTH Operating System and Programming Language, and to supply application programming to meet customers' unique requirements.

FORTH enjoys a synergism of its features. It has none of the elephantine characteristics of PL/1 or FORTRAN. It has a density and speed far surpassing BASIC, but retains an interactive nature during program development. Since it is extensible, special words are easily defined to give it the terseness of APL. Its clarity and consistency result from being the product of a single mind. (as were APL and PASCAL).

Although the language specification and many implementations are in the public domain, many other implementations and application packages are available as program products of commercial suppliers.

The FORTH Interest Group is centered in Northern California. It was formed in 1978 by local FORTH programmers to encourage use of the language by the interchange of ideas though seminars and publications. About 300 members are presently associated into a loose national organization. ('Loose' means that no budget exists to support any formal effort.) All effort is on a volunteer basis and the group is associated with no vendors.

S W.F.R 8/20/78

FOR NEWCOMERS

<section begin="newcomers"> FORTH listings consist of sequences of "words" that execute and/or compile. When you have studied a glossary and a few sample listings, you should develop the ability to understand the action of new words in terms of their definition components. For the time being, we present a simplified glossary of the undefined words in this issue of FORTH . For a fuller listing send for the F.I.G Glossary.

: xxx ..... ;

':' creates a new word named 'xxx' and complies the following words (represented at ....) until reaching ';'. When 'xxx' is later used, it executes the words right after its name until the ';'.

CONSTANT VARIABLE

Each creates a new word with the following name, which takes its value from the number just before.

IF ELSE THEN

A test is made at 'IF'. If true, the words execute until the 'ELSE' and skip until THEN. If false, skip until ELSE and execute until THEN.

BEGIN END

At END a test is made; if false, execution returns to BEGIN; otherwise continue ahead.

DO LOOP LEAVE

At DO a limit and first index are saved. At LOOP, the index is incremented; until the limit is reached, execution returns to DO. LEAVE forces execution to exit at LOOP.

DUP DROP OVER SWAP ROT + - * /

These words operate on numbers in a stack just as then do in a HP calculator. If you like HP, you'll love FORTH.

>R R>

>R moves the top stock number to another stock. R>

it back to the original stack.


@ @ @ Fetches the 16 bit contents of an address. C@ does the same for a byte. C@ may be also called B@ or \@.

These words store the second stack number at the memory address on the tap of the stack. C1 stores only a byte; it may be named BI or \1 on some systems,

TYPE types a string by memory address and character count.

SPACE types a space.

CR types a carriage return/line feed.

MOVE moves within memory by addresses and byte count.

. prints a number,

.R prints a number In a tabulated column.

2+ adds two to the stack top number.

STATE is a variable, true when compiling.

( skips over comments until finding a ')'.

EXECUTE executes the word whose address is on the stack.

' finds the address of the next input name.

AND is a bitwise logical and,

, places a number in memory as part of compiling.

= > < are logical comparisons of stack numbers.

20 WORD fetches the next input word string.

HERE is a temporary memory workspace.

IMMEDIATE <BUILDS DOES> are too involved to discuss here, They are described in some detail in the text.

PAGE 11
FORTH INTEREST GROUP
P.O. Box 1105
San Carlos, Ca. 94070