home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / forth / compiler / fpc / tutor / l1p030 < prev    next >
Encoding:
Text File  |  1990-05-16  |  3.3 KB  |  95 lines

  1.         ╔══════════════════════════════════════════════════════╗
  2.         ║  Lesson 1 Part 3.0  F-PC 3.5 Tutorial by Jack Brown  ║
  3.         ╚══════════════════════════════════════════════════════╝
  4.  
  5. Glad to see you back.  Start you Forth engines, we are about to begin
  6. again.  Here is a summary of the ideas of the last message and some new
  7. words that we are going to look at.
  8.  
  9.                  ┌────────────────────────────────┐
  10.                  │  Elementary Word Definitions.  │
  11.                  └────────────────────────────────┘
  12.  
  13. : {name}    word1  word2 . . . wordn  ;
  14.  
  15. :       Begin a word definition.
  16.  
  17. ;       End a word definition.
  18.  
  19. {name}  This is the name of the new word definition.
  20.  
  21. word1 word2 ...  Forth words in definition.
  22.  
  23. Example:
  24.  
  25. : FIRST   CR  ." This is my first FORTH program. "  ;
  26.  
  27. ."  {string}"   Compiles string,  when word is executed string
  28.                 is displayed on the display or console device.
  29.  
  30. CR              Start a new line. ( carriage return/line feed )
  31.  
  32.                ┌─────────────────────────────────┐
  33.                │   Some Important System Words.  │
  34.                └─────────────────────────────────┘
  35.  
  36. WORDS         List all words in the FORTH dictionary.
  37.  
  38. EMPTY         Remove all new words added since entering FORTH
  39.  
  40. FORGET {name} Remove {name} and all words defined since {name}
  41.               from the FORTH dictionary.
  42.  
  43. First try  WORDS <enter>    <---- quickly press  ESC before
  44.  
  45. your screen fills up!  You can also use the space bar to temporarily
  46. halt the words listing.  You should see the first name list for you
  47. favorite people phone list if you saved the system as instructed in the
  48. last message.
  49.  
  50. Let's  suppose that you don't like these people any more and that you
  51. want to remove them from the system.  To do this you can just type:
  52.  
  53. EMPTY <enter>  <---- do this now.
  54.  
  55. Now try getting my phone number by typing  JACK as before.
  56. Did you get the phone number ??  Type:
  57.  
  58. WORDS <enter>   <---  Stop it quickly !!
  59.  
  60. Do you see the phone list ???   Your phone list should be gone.  You
  61. have Forth back to its original state. Now exit the Forth system. Type:
  62.  
  63. BYE <enter>
  64.  
  65. And start it up again with   F at the DOS prompt. Type:
  66.  
  67. WORDS <enter>
  68.  
  69. and you should see the phone list again.  This is because we did not
  70. re-save the forth system using the FSAVE command.  We will do this
  71. shortly but first lets suppose you don't want to forget the entire phone
  72. list. Suppose you only want to forget the last word (person) that you
  73. added.  To do this type
  74.  
  75. FORGET  {name}  <enter>
  76.  
  77. Do this now and type WORDS to see if  {name} has been forgotten. You
  78. could also type {name} to see if Forth can still find the phone number.
  79.  
  80. Well let's get rid of the phone list once and for all!  We will have to
  81. empty the system of all the words that we have added by typing  EMPTY
  82. <enter>  again.  And then we will have to re-save the Forth system by
  83. typing
  84.  
  85. FSAVE F <enter>
  86.  
  87. Do this now and then exit Forth by typing BYE. Now start Forth again and
  88. see if your phone list has been forgotten for good.  You can find out by
  89. trying to get back one of the phone numbers or by using WORDS to look
  90. for your favorite people.  You should find that they no longer exist!
  91.  
  92. ┌────────────────────────────────────┐
  93. │  Please move to Lesson 1 Part 4.0  │
  94. └────────────────────────────────────┘
  95.