This page (revision-82) was last changed on 03-Jan-2024 15:31 by bartgo 

This page was created on 20-Feb-2010 20:56 by Carsten Strotmann

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Page revision history

Version Date Modified Size Author Changes ... Change note
82 03-Jan-2024 15:31 7 KB bartgo to previous
81 03-Jan-2024 15:13 7 KB bartgo to previous | to last

Page References

Incoming links Outgoing links

Version management

Difference between version and

At line 6 changed one line
Forth is an interpreted programming language that uses a stack-based metaphor in an effort to reduce memory requirements as much as possible. It is perhaps the only successful example of such a language; the PostScript system was derived from it and saw much widespread use, but this was hidden inside the printers and not seen by end-users or programmers.
Forth is a cancatenative stack-based programming language.
At line 8 changed one line
Stack-based languages simplify the interpreter's parser considerably because the data for an instruction always appears in the source code before the instructions that will use it. To see why this helps, consider this typical line of [Basic]:\\
Stack-based languages simplify the language's parser considerably because the data for an instruction always appears in the source code before the instructions that will use it. To see why this helps, consider this typical line of [Basic]:\\
At line 12 changed one line
To perform this line, the interpreter has to read the entire line, look up the value of B (let's say 30), realize that the * has to be performed before + and order the instructions correctly, and then finally convert those into instructions something like:\\
To perform this line, the interpreter has to read the entire line, look up the value of B (let's say 3), realize that the * has to be performed before + and order the instructions correctly, and then finally convert those into instructions something like:\\
At line 24 changed one line
When this code is performed, the interpreter pushes the value of B on the stack, then 20. It then encounters the mul, which removes the last two items, the 30 and 20, multiplies them, and puts the result back on the stack. Next, it pushes 10 on the stack, leaving the top two locations containing 60 and 10. It then encounters add, taking the two values, adding them, and putting the result back on the stack. The top of the stack now contains the result, 70.
When this code is performed, the interpreter pushes the value of B on the stack, then 20. It then encounters the mul, which removes the last two items, the 3 and 20, multiplies them, and puts the result back on the stack. Next, it pushes 10 on the stack, leaving the top two locations containing 60 and 10. It then encounters add, taking the two values, adding them, and putting the result back on the stack. The top of the stack now contains the result, 70.
At line 28 changed one line
Another key aspect of the language was Forth's inherently multitasking design. The program could set up separate stacks and feed different code into each one. The Forth kernel would run each of these stacks in turn, so all Forth programs had access to these features. This made writing multithreaded code very easy, so one could, for instance, have a thread reading the joystick as it moved, and then read that value in a game loop in another stack.
Another key aspect of the language is Forth's inherently multitasking design. The program could set up separate stacks and feed different code into each one. The Forth kernel would run each of these stacks in turn, so all Forth programs had access to these features. This made writing multithreaded code very easy, so one could, for instance, have a thread reading the joystick as it moved, and then read that value in a game loop in another stack.
At line 30 removed 4 lines
The downside to the stack-based approach is that it makes the language difficult to understand by mere mortals. Even tutorials purporting to show how simple it was often ended in an unreadable mess. As a result, Forth was subject to perhaps one of the longest running fanboi wars since APL was invented. Constantly derided by practically everyone in the industry, it saw some interest in spite of this, but little commercial software emerged. The singular exception is the PostScript system, which is essentially a version of Forth modified to produce graphics output.
The Atari 8-bits were being sold right in the middle of this battle, and as a result there was a fair amount of support on the platform and some interest in the press.
At line 59 added 2 lines
* [Elcomp Forth_DOS 25.atr]; Atari Version of Elcomp-Forth by E.Floegel & H.C.Wagner, 1982
* [Grafs Atari-Forth DOS 2.5.atr|Grafs_Atari-Forth_DOS_2.5.atr]; from Andreas Graf ca. 1990