home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-386-Vol-2of3.iso / v / vsnbl220.zip / WORDS.SNO < prev    next >
Text File  |  1991-02-14  |  603b  |  24 lines

  1. *   WORDS.SNO -- word counting program
  2. *
  3. *    Sample program from Chapter 6 of the Tutorial
  4. *
  5. *   A word is defined to be a contiguous run of letters,
  6. *   digits, apostrophe and hyphen.  This definition of
  7. *   legal letters in a word can be altered for specialized
  8. *   text.
  9. *
  10. *   If the file to be counted is TEXT.IN, run this program
  11. *   by typing:
  12. *    B>SNOBOL4 WORDS /I=TEXT
  13. *
  14.     &TRIM    =  1
  15.     WORD    =  "'-"  '0123456789' &UCASE &LCASE
  16.     WPAT    =  BREAK(WORD) SPAN(WORD)
  17.  
  18. NEXTL    LINE    =  INPUT            :F(DONE)
  19. NEXTW    LINE WPAT =                :F(NEXTL)
  20.     N    =  N + 1            :(NEXTW)
  21.  
  22. DONE    OUTPUT =  +N ' words'
  23. END
  24.