Page:Forth Dimension Volume 01 Number 1.pdf/5

From Wikisource
Jump to navigation Jump to search
This page has been proofread, but needs to be validated.

FORTH LEARNS GERMAN

By John James


Forth now understands German, thanks to the following redefinitions of the operations in the Decus (Caltech) Forth manual.

Many of the operations were mathematical symbols, and of course they did not have to be translated. Of the rest, the control operations (IF, THEN, ELSE, BEGIN, END, DO, LOOP, +LOOP) are special, because they are "immediate operations"; that is, they are executed at compile time. Just redefining their names would not work, because they would try to execute right in the definitions. So their original definitions were copied, but with the German names.

Program development time for bilingual capability, two hours. Memory required, 600 bytes. Effect on run-time execution speed, zero.

BLOCK 30
1 ( GERMAN. JJ, 6/19/78)
2 : ABWERFEN DROP ; : UBER OVER ;
3 : VERT SWAP ; : SPAREN SAVE ; : UNSPAREN UNSAVE ;
4 : UNBEDINGT ABS ; : UND AND ;
5 : HOCHST MAX ; : MINDEST MIN ; : REST MOD ;
6 : ODER OR ; : /REST /MOD ; : 0SETZEN 0SET ;
7 : 1SETZEN 1SET ; : HIER HERE ; VERGESSEN FORGET ;
8 : SCHLUSSEL CODE ; : BESTANDIG CONSTANT ;
9 : GANZE INTEGER ; : ORDNUNG ARRAY ; : IORDNUNG IARRAY ;
10 : SETZEN SET ;
11 : AUFS-LAUFENDE UPDATE ; : AUSRADIEREN ERASE-CORE ;
12 : LADEN LOAD ; : ZURUCK CR ;
13 : SCHREIBEN TYPE ; : BASIS BASE ;
14
15
16 ( THE SAME: DUP, MINUS, =L, BLOCK, ;S, F) ;S

The control operation definitions (OB, DANN, SONST, BEGINNEN, ENDEN, TUN, SCHLINGE, +SCHLINGE) are not shown here; they are all short (one line), and exact copies of the English operations. (Incidently this particular vocabulary is a rough draft; we have not seen the results of the International Forth Standards Team, which is currently at work.) The word GERMAN is defined on the load screen, so that the Forth user can call in the German vocabulary when desired.

The following session shows the entry and execution of a fibonacci

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