A SNOBOL pattern can be very simple or extremely complex. A simple pattern is just a text string (e.g. "ABCD"), but a complex pattern may be a large structure describing, for example, the complete grammar of a computer language. It is possible to implement a language interpreter in SNOBOL almost directly from a Backus–Naur form expression of it, with few changes. Creating a macro assembler and an interpreter for a completely theoretical piece of hardware could take as little as a few hundred lines, with a new instruction being added with a single line.
...
Patterns can be saved like any other first-class data item, and can be concatenated, used within other patterns, and used to create very complex and sophisticated pattern expressions. It is possible to write, for example, a SNOBOL4 pattern which matches "a complete name and international postal mailing address", which is well beyond anything that is practical to even attempt using regular expressions.
There were, and I kid you not, two simular languages; "SLUSHBOL" and "SPITBOL". But they are lost for the ages.
Edit: I see that SPITBOL has been observed. No word on SLUSHBOL.
When I was a sysadmin at the Naval Research Laboratory in the 80s, I was asked to install Icon, Ralph Griswold’s follow-on language to SNOBOL. I had a little trouble installing it on our Gould minicomputer and mailed in a support request. It was answered by Griswold himself! I felt special! (It was just a Makefile issue, as I recall. This was the era of tar source file distribution. No rpms, no snaps, no debs.)
> I had a little trouble installing it on our Gould minicomputer and mailed in a support request
Not sure if this means snail mail, but I don't know why I never considered that before email, people used physical mail for things like tech support, heck, maybe submitting patches
Sometimes you'd see a program you wanted in the back pages of pcworld or another one of those huge computer-warehouse type magazines, and you'd have to fill out a little card and mail in a check while trusting that in a month or two it'd arrive.. I got wolf3d, jill of the jungle, and commander keen this way.
We would physically mail 9-track tapes back and forth all the time. If you wanted, say, the BSD 4.2 Unix distribution, that was more efficient than downloading it over a 56kbps DDS line or some such.
Oh wow, I learned a little Icon in college as part of a class on different programming paradigms. As soon as I saw the thread title I thought, "That sounds a lot like Icon."
We also covered Scheme, Prolog, and . . . Java. :-) Okay this was the 90s when OO was new, but still maybe they should have gone with something like Smalltalk.
Oh man. Smalltalk has a huge learning curve. Of course, once you master a few dozen concepts you can just crank out the applications.
I once was paid real money to develop in VA Smalltalk. It was a fun language. Dave Ungar and Dan Ingalls said a few things that made me think they planned at one point to add spitbol-esque features to Smalltalk. And Alan Kay once quipped something about wishing he had seen scheme before writing smalltalk grammar.
For better or worse, bits of Smalltalk live on in Java and Ruby and bits of Scheme can be found in JavaScript if you look hard enough. Where did Icon and Spit/Sno-bol wind up? Alas.
-- SPITBOL-like interface facilities
-- This package provides a set of interfaces to semantic operations copied
-- from SPITBOL, including a complete implementation of SPITBOL pattern
-- matching. The code is derived from the original SPITBOL MINIMAL sources,
-- created by Robert Dewar. The translation is not exact, but the
-- algorithmic approaches are similar.
The SNOBOL4 language translator was still written in assembly language. However the macro features of the assembler were used to define the virtual machine instructions of the SNOBOL Implementation Language, the SIL
Was SIL the inspiration for ZIL (Zork Implementation Language) which was also a virtual machine and allowed Infocom to release their text adventures on so many home computer platforms at once in the 80s?
https://en.wikipedia.org/wiki/SPITBOL FTW! I got turned onto SPITBOL in the early '00's from a colleague who used it as a rapid utility language for writing small command line apps.
While studying Computer Science as an undergrad, I took a SNOBOL course (or maybe it one of the languages taught in a general coding course) ...either way, it was glorious. I love languages that are 'task-oriented'.
My all-time favorite was GPSS (General Purpose Simulation System) which would simulate transactions in a model...think of cars arriving from four directions at a traffic light. You could tweak the car arrival times and the length of red/green lights and get different outputs for 'wait time'.
I loved it so much, I asked my professor if there were good opportunities for a career using GPSS. He answered 'no' (LOL) and so I never pursued it.
I love Snobol (and its descendent spitbol.) While an engineer at a large, unnamed company named after a river in South America, I was somewhat amazed by how "No computing problem was untouched by regular expressions" including scanning html. After many hilarious inter-team failures, we finally got approval to speak with our peers. I pointed out that HTML can't "really" be parsed with regexes (yes, I know, there are subsets of HTML that regexes work perfectly well with, but in this instance we did not control the input). Thus got a lot of blank looks. Then I mentioned "context free" versus "regular" and more blank looks. Someone in the back made a quip about not expecting a CS101 lecture at work.
Over the next two days I did a Mini-Course for a few engineers about why you may not want to use RegExes for everything. Spitbol played a leading role and those engineers walked away enlightened.
They were, of course, fired because they started asking other engineers in the company to modify their outputs so they could be parsed reliably with regexes. But that's okay, they went on to successful careers at other companies who provided decent health care options.
So... at least for a small number of engineers in Seattle, SNOBOL resulted in them getting decent health insurance.
I call that a win.
Also... I know half the people reading this will say something like "of course you can parse HTML with RegExes! I do it all the time!" -- I suggest you're parsing a subset of (x)(ht)(ml) and your code can easily get flummoxed with valid HTML, just not in the format you were used to. If you can recover from regex failures or modify the input to the regex so you don't get failures, more power to you! I'm not gonna argue with someone producing working code. The person who maintains your code after you leave may curse your name, however. But by that time your uber stock will be worth something and you'll be driving your bitcoin lambo to the beach every day so what do you care?
Anyway, SO had A LOT of discussion about RegExes and HTML:
"Alas, poor SNOBOL! I knew him, HN: a language of infinite jest, of most excellent fancy: he hath borne me over the pains of regular languages a thousand times; and now, how abhorred in industry it is!"
The paper "Implementing SNOBOL4 in SIL; version 3.11" by Griswold is interesting to look at (<www.regressive.org/snobol4/doc/arizona/s4d58.pdf>). It looks like there is some code at github (https://github.com/mdhender/sil/blob/main/v311.sil) but I haven't looked at the provenance of it.
This brings back memories of the way they used to teach programming. I had to learn some SNOBOL for a class, but to this day I've never written a line of it. We didn't even have access to such machines. Lectures were done on a chalkboard. The few programming assignments (in Pascal?) were done on our own in a lab elsewhere on campus. We'd print out the program and output and it'd be graded by hand.
I learned Fortran this way - learned from the book and just wrote pages of programs by hand, never running them because, no computer. Appeared in exam and did the same thing, got graded and done. Still no computer.
I can see why. One is a whimsically-named, serious language. The other is a seriously-named, whimsical language (from what I can tell).
(It's also somehow strange to see the author photos accompanying that article, I guess since for one, unlike many other -lang-article-photos, these seem fairly up-to-date, turning the popular-language-with-old-photos wiki-norm on its head)
Except for the name, which IIRC was an intentional dig at an early COBOL standard that defined how you pronounced 'COBOL'. 'SNOBOL' can sound like 'snow-ball', analogous to a US accent where COBOL can be pronounced 'CO-ball'.
[Edit] I used SNOBOL briefly in the 80s at Uni. It was one of the first 'odd' languages we were introduced to after Pascal, along with APL.
I think the accents here were exaggerated for comedic effect. You are a right, I’m a Brit and would personally pronounce the ‘BOL’ to sound like ‘doll’ rather than ‘ball’. Unfortunately I can’t now find a reference to the original standards
I learned and used SNOBOL for RBK Dewar's compiler classes at NYU, 78-79. (Dewar was one of the authors of SPITBOL, an implementation of the language).
Because of this, experience, a couple of years later, in grad school elsewhere, I was able to help someone in the computing center debug a client's SNOBOL program.
Sure, this wasn't a huge insurance company writing their payroll system, but SNOBOL was a real language. But ignoring that: SNOBOL was a completely unique language, beautiful in its own way. It looked like a very sparse form of assembler language. Control flow was bizarre: a statement could "succeed" or "fail", and a statement could specify goto targets for either, both, or none of these cases. (I don't know the exact dates, but SNOBOL must have been designed around the same time as the famous "Goto considered harmful" letter.)
As a measure of how good the language was: SNOBOL is famously based on the idea of string pattern matching. I found SNOBOL completely intuitive and easy to use. By contrast, I find UNIX regular expressions incomprehensible, and they send me to RTFM each time I use them. I have a similar view of Perl. Ugly and unintuitive, the exact opposite of SNOBOL.
Also, I would like to recommend the Griswold, Poage, and Polonski book on SNOBOL4. I remember it as a truly excellent language book, on the level of K&R.
Nice to hear mention of RBK Dewar. He was well known in the programming languages field as a professor at NYU, but also was quite successful as an entrepreneur with his various compilers (I think his company was called "Realia").
I took one of his classes as an undergraduate at NYU, but used SNOBOL, SETL, and some other early languages as part of a young scholars high school program at NYU in the early 80s.
I remember SETL, and it made a huge impression on me -- just the idea of sets as a primitive datatype. I remember one lecture on using SETL to specify language optimizations, which were set-oriented.
Also, that experience primed me for appreciating the relational model, and relational algebra, and I went on to specialize in DBMSs.
Imagining some 1980s Hacker News clickbait #1 headlines:
- Towers of Hanoi in SNOBOL
- It's true: Ada on CP/M
- Discover your inner extrovert with Smalltalk-80
- In the '90s everything will be in Eiffel
- How to ace your next Modula-2 interview
Heh. I got into computing in the 80s, and your other headlines are much more plausible. I did find a very interesting library book Algorithms in SNOBOL4 by Gimpel, so I actually got familiar with it -- but that was sheer luck.
(The book's title is misleading now: it doesn't much overlap a modern undergrad intro to algorithms. It's more "here are examples and techniques of programming in SNOBOL".)
Is it even a 1980s programming language without a Hanoi example?
Here's the program in its all-caps, weirdly indented beauty:
DEFINE('HANOI(N,NS,ND,NI)') :(HANOI.END)
HANOI EQ(N,O) :S(RETURN)
HANOI(N - 1,NS,NI,ND)
OUTPUT 'MOVE DISC ' N ' FROM ' NS ' TO ' ND
HANOI(N - 1,NI,ND,NS) :(RETURN)
HANOI.END
TEST HANOI (5,'A','C','B')
END
Actually, SNOBOL is a 1960s programming language[1], so it wouldn't have been a trendy new language in an 80s version of HN.
In the 1960s, most programming was done on punched cards, and keypunch machines (and many computers) didn't have lower case letters on them. Hence, languages from that era, like FORTRAN, COBOL, PL/I, LISP and assembly language, were written in all-caps.
I took a class on programming languages from Douglas Maurer, who had written a book on SNOBOL. It was out of print, which saved a few dollars for the students, since he provided photocopies. SNOBOL did not look especially practical, but the built-in pattern matching made Awk and Perl that much easier to learn.
(Maurer also composes or composed music. His madrigal "Forty Bucks" set to music the text of a Montgomery County, Maryland, photo enforcement ticket.)
Thank you! I took a programming languages survey course when getting my Masters at GWU in the early 90s. It was taught by Dr. Maurer. I couldn’t remember his name, but I did remember that he was into SNOBOL. I really need to find his “Forty Bucks” madrigal.
It was performed by an amateur theatre group called "The Hexagon Club", at a show maybe a dozen years ago. I've searched on-line without luck--it probably doesn't help that Tom T. Hall wrote a song called "The Ballad of Forty Dollars". Anyway, good luck.
SNOBOL was the first language I learned with pattern matching. It was, at least to my memory, pretty much the main interesting feature of the language.
True. I had a professor mention SNOBOL a few times in lectures. The same professor only taught classes in Scheme, including CS 101 and Software Engineering. The man was stuck in the 80s in every way.
A SNOBOL pattern can be very simple or extremely complex. A simple pattern is just a text string (e.g. "ABCD"), but a complex pattern may be a large structure describing, for example, the complete grammar of a computer language. It is possible to implement a language interpreter in SNOBOL almost directly from a Backus–Naur form expression of it, with few changes. Creating a macro assembler and an interpreter for a completely theoretical piece of hardware could take as little as a few hundred lines, with a new instruction being added with a single line.
...
Patterns can be saved like any other first-class data item, and can be concatenated, used within other patterns, and used to create very complex and sophisticated pattern expressions. It is possible to write, for example, a SNOBOL4 pattern which matches "a complete name and international postal mailing address", which is well beyond anything that is practical to even attempt using regular expressions.