home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
snobol4
/
vsnobol4.arc
/
WORDS.SNO
< prev
next >
Wrap
Text File
|
1987-12-04
|
603b
|
24 lines
* WORDS.SNO -- word counting program
*
* Sample program from Chapter 6 of the Tutorial
*
* A word is defined to be a contiguous run of letters,
* digits, apostrophe and hyphen. This definition of
* legal letters in a word can be altered for specialized
* text.
*
* If the file to be counted is TEXT.IN, run this program
* by typing:
* B>SNOBOL4 WORDS /I=TEXT
*
&TRIM = 1
WORD = "'-" '0123456789' &UCASE &LCASE
WPAT = BREAK(WORD) SPAN(WORD)
NEXTL LINE = INPUT :F(DONE)
NEXTW LINE WPAT = :F(NEXTL)
N = N + 1 :(NEXTW)
DONE OUTPUT = +N ' words'
END