home *** CD-ROM | disk | FTP | other *** search
- ╔══════════════════════════════════════════════════════╗
- ║ Lesson 1 Part 3.0 F-PC 3.5 Tutorial by Jack Brown ║
- ╚══════════════════════════════════════════════════════╝
-
- Glad to see you back. Start you Forth engines, we are about to begin
- again. Here is a summary of the ideas of the last message and some new
- words that we are going to look at.
-
- ┌────────────────────────────────┐
- │ Elementary Word Definitions. │
- └────────────────────────────────┘
-
- : {name} word1 word2 . . . wordn ;
-
- : Begin a word definition.
-
- ; End a word definition.
-
- {name} This is the name of the new word definition.
-
- word1 word2 ... Forth words in definition.
-
- Example:
-
- : FIRST CR ." This is my first FORTH program. " ;
-
- ." {string}" Compiles string, when word is executed string
- is displayed on the display or console device.
-
- CR Start a new line. ( carriage return/line feed )
-
- ┌─────────────────────────────────┐
- │ Some Important System Words. │
- └─────────────────────────────────┘
-
- WORDS List all words in the FORTH dictionary.
-
- EMPTY Remove all new words added since entering FORTH
-
- FORGET {name} Remove {name} and all words defined since {name}
- from the FORTH dictionary.
-
- First try WORDS <enter> <---- quickly press ESC before
-
- your screen fills up! You can also use the space bar to temporarily
- halt the words listing. You should see the first name list for you
- favorite people phone list if you saved the system as instructed in the
- last message.
-
- Let's suppose that you don't like these people any more and that you
- want to remove them from the system. To do this you can just type:
-
- EMPTY <enter> <---- do this now.
-
- Now try getting my phone number by typing JACK as before.
- Did you get the phone number ?? Type:
-
- WORDS <enter> <--- Stop it quickly !!
-
- Do you see the phone list ??? Your phone list should be gone. You
- have Forth back to its original state. Now exit the Forth system. Type:
-
- BYE <enter>
-
- And start it up again with F at the DOS prompt. Type:
-
- WORDS <enter>
-
- and you should see the phone list again. This is because we did not
- re-save the forth system using the FSAVE command. We will do this
- shortly but first lets suppose you don't want to forget the entire phone
- list. Suppose you only want to forget the last word (person) that you
- added. To do this type
-
- FORGET {name} <enter>
-
- Do this now and type WORDS to see if {name} has been forgotten. You
- could also type {name} to see if Forth can still find the phone number.
-
- Well let's get rid of the phone list once and for all! We will have to
- empty the system of all the words that we have added by typing EMPTY
- <enter> again. And then we will have to re-save the Forth system by
- typing
-
- FSAVE F <enter>
-
- Do this now and then exit Forth by typing BYE. Now start Forth again and
- see if your phone list has been forgotten for good. You can find out by
- trying to get back one of the phone numbers or by using WORDS to look
- for your favorite people. You should find that they no longer exist!
-
- ┌────────────────────────────────────┐
- │ Please move to Lesson 1 Part 4.0 │
- └────────────────────────────────────┘
-