I had planned to snark about the French burka law proposal, but I've had a bad day and can't be arsed, so instead I console myself (ha ha) playing with an ancient programming language.

SNOBOL is one of those languages developed in the 1960s when not all languages had to look like a clone of C and GOTO was not yet considered harmful. SNOBOL is a pattern matching language, which you can use for rewriting strings, much like what you'd do with, say awk, but without the benefit of loop statements or proper functions—all these are instead achieved through labels, each statement optionally containing a GOTO.

There are modern implementations of SNOBOL, so I downloaded one. It compiled nicely and as a test I wrote my favourite test application, the Hailstone program, even though it makes no use of the pattern matching functions. Viz:

EQ(I , 1) :S(END)
K = I / 2
EQ(2 * K , I) :S(EVEN) F(ODD)
EVEN I = K :(DO)
ODD I = 3 * I + 1 :(DO)

As you see, we have labels in the left column, the code in the middle, and then the GOTOs in the rightmost column, preceded by :. S indicates a conditional jump if the matching succeeded, F if the match failed. The rest should be pretty obvious.

No comments: