Phoenix.pm: "Why Not To Use Foreign Keys" ?
Scott Walters
scott at illogics.org
Wed Apr 21 19:07:49 CDT 2004
Sure =)
A simple loop...
LOOPS = 10000
&STLIMIT = LOOPS * 2 + 10
A = 0
LOOP A = A + 1
LT(A,LOOPS) :S(LOOP)
END
Word counting program...
* 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
UCASE = "ABCDEFGHIJLKMNOPQRSTUVWXYZ"
LCASE = "abcdefghijlkmnopqrstuvwxyz"
WORD = "'-" '0123456789' UCASE LCASE
BP = BREAK(WORD)
SP = SPAN(WORD)
WPAT = BREAK(WORD) SPAN(WORD)
NEXTL LINE = INPUT :F(DONE)
* OUTPUT = '>' LINE
NEXTW
* LINE WPAT = :F(NEXTL)
LINE BP =
LINE SP = :F(NEXTL)
* OUTPUT = '>>' LINE
N = N + 1 :(NEXTW)
DONE OUTPUT = +N ' words'
END
And some sample pattern matching... pattern matching is
SNOBOL's "thing"...
RSI_2 SS '<' ARB . NM '>::=' =
RSENT_TBL<NM> = '|' SS
IDENT(S,'END') :S(RSENTENCE_END)
SS = S :(RSI_1)
Sorry this isn't very coherent... I'll put together something
better later ;)
-scott
On 0, Eden Li <Eden.Li at asu.edu> wrote:
>
> I've never seen SNOBOL code. Can you grace the list with a few lines?
>
> On Wed, 21 Apr 2004, Scott Walters wrote:
> > SNOBOL would be dead if Philip Budne hadn't rewritten the 360 bits
> > in portable C 7 years back, but now, fools like me run it ;)
>
More information about the Phoenix-pm
mailing list