This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
tutorials:forth [2022/01/08 12:42] papa |
tutorials:forth [2022/06/07 02:10] (current) rcs correct lack of space after dot commands in examples |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| [[http:// | [[http:// | ||
| + | |||
| + | There are two Forth implementation available. | ||
| **FORTH-10** is a Forth language interpreter included in the Panda TOPS-20 distribution. The anonymous programmer describes the implementation as "NOT totally standard" | **FORTH-10** is a Forth language interpreter included in the Panda TOPS-20 distribution. The anonymous programmer describes the implementation as "NOT totally standard" | ||
| - | ====== Survival Guide ====== | + | **FORTH** is another interpreter originally written on the MIT AI lab DEC-20 called OZ, by John Wilson. |
| - | Start the interpreter on TWENEX with the command '' | + | ====== |
| - | | + | Start the interpreter on TWENEX with the command '' |
| + | |||
| + | | ||
| FORTH-10 | FORTH-10 | ||
| Ok | Ok | ||
| Line 17: | Line 21: | ||
| 7 3 Ok ( Push 7 then 3 on stack. ) | 7 3 Ok ( Push 7 then 3 on stack. ) | ||
| + Ok ( Remove two items from stack (3 and 7), push the sum on stack, so 10 is only item. ) | + Ok ( Remove two items from stack (3 and 7), push the sum on stack, so 10 is only item. ) | ||
| - | .10 Ok ( Word . pops top stack item and prints it. Stack is now empty. ) | + | . 10 Ok ( Word . pops top stack item and prints it. Stack is now empty. ) |
| | | ||
| Words '' | Words '' | ||
| 3.14159 Ok | 3.14159 Ok | ||
| - | f.3.14159 Ok ( f. pops stack and displays as floating-point. ) | + | f. 3.14159 Ok ( f. pops stack and displays as floating-point. ) |
| | | ||
| Add new words to the dictionary with the defining words '':'' | Add new words to the dictionary with the defining words '':'' | ||
| Line 33: | Line 37: | ||
| ( previous top value, multiply and push product on stack. | ( previous top value, multiply and push product on stack. | ||
| 7 TIMES5 Ok ( Execute the word. ) | 7 TIMES5 Ok ( Execute the word. ) | ||
| - | .35 Ok ( Pop and display result. ) | + | . 35 Ok ( Pop and display result. ) |
| | | ||
| List words currently defined in the dictionary with '' | List words currently defined in the dictionary with '' | ||
| Line 47: | Line 51: | ||
| Forth source files can be prepared with any editor. Load and interpret source files in FORTH-10 with the command '' | Forth source files can be prepared with any editor. Load and interpret source files in FORTH-10 with the command '' | ||
| - | ===== Hello, World! ===== | + | ====== Hello, World! |
| : HELLO CR ." " | : HELLO CR ." " | ||
| Line 75: | Line 79: | ||
| At start-up, FORTH-10 searches the user's log-in directory for a file named '' | At start-up, FORTH-10 searches the user's log-in directory for a file named '' | ||
| + | |||
| + | ====== FORTH ====== | ||
| + | |||
| + | Start the John Wilson' | ||
| + | |||
| + | @FORTH | ||
| + | FORTH/Oz v1 (JohnW) | ||
| + | ok | ||
| + | | ||
| + | Exit FORTH with the command '' | ||
| + | |||
| + | |||
| + | ====== Reference ====== | ||
| + | |||
| + | //Starting FORTH// is the standard introductory text for the Forth language. | ||
| + | |||
| + | * Leo Brody, //Starting FORTH//. Forth, Inc. https:// | ||
| + | |||