Phoenix.pm: Re: SNOBOL - resending
Scott Walters
scott at illogics.org
Sat Apr 24 01:14:08 CDT 2004
I never saw this message come back from the list so I'm assuming the list
lost it. Resending. Sorry. Lisp has been a bit flakey the last 3 or 4 years...
This was in response to Victor's request for Perl translators of the
SNOBOL examples.
-scott
----- Forwarded message from Scott Walters <scott at illogics.org> -----
Date: Wed, 21 Apr 2004 17:07:49 -0700
From: Scott Walters <scott at illogics.org>
To: Eden Li <Eden.Li at asu.edu>
Cc: 20040421230211.GE120 at illogics.org
Subject: Re: Phoenix.pm: "Why Not To Use Foreign Keys" ?
Message-ID: <20040422000749.GF120 at illogics.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.5i
Status: RO
Content-Length: 1843
Lines: 71
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 ;)
>
----- End forwarded message -----
More information about the Phoenix-pm
mailing list