SNOBOL is a family of string-processing languages developed at Bell Telephone Laboratories from 1962 by David J. Farber, Ralph E. Griswold and Ivan P. Polonsky. While most languages of the time were built to crunch numbers, SNOBOL was built to manipulate text, and its pattern-matching system was far more capable than anything else available. Understanding how SNOBOL string pattern matching works explains why the language had such a loyal following among linguists, humanities researchers and compiler writers.
Origins at Bell Labs
The Bell Labs group needed a tool for symbolic work, including manipulating formulas and processing strings, and found existing options such as COMIT too limited. The first SNOBOL ran on an IBM 7090 in 1962. The name is usually expanded as "StriNg Oriented and symBOlic Language", though the expansion is widely regarded as a tongue-in-cheek backronym.
The language evolved quickly:
- SNOBOL (1962) – strings and simple patterns.
- SNOBOL2 and SNOBOL3 (mid-1960s) – added functions and more pattern features; SNOBOL3 became popular on IBM 7090/7094 installations.
- SNOBOL4 (released around 1967) – a major redesign in which patterns became first-class data objects, implemented through a portable macro language so it could move between machines.
Griswold later moved to the University of Arizona, where he designed Icon (1977), a successor that carried SNOBOL's ideas into a more conventional structured syntax.
How SNOBOL string pattern matching works
A SNOBOL4 statement has up to five parts: a label, a subject string, a pattern, an optional replacement after an equals sign, and a goto field. The interpreter tries to match the pattern against the subject. If the match succeeds, the matched part can be replaced, and control jumps to the success label (:S(...)); if it fails, control jumps to the failure label (:F(...)).
Patterns are built from primitives and combined:
- Concatenation (writing patterns side by side) means "this followed by that".
- Alternation with
|means "this or that". - Built-in functions such as
ANY,NOTANY,SPAN,BREAK,LENandARBdescribe classes of strings. - The
.and$operators assign matched substrings to variables, either after a successful match or immediately during scanning.
Because the matcher backtracks and patterns can refer to themselves through unevaluated expressions, SNOBOL4 patterns can recognise far more than regular expressions can, including recursive structures like balanced parentheses (there is even a built-in BAL pattern).
A short SNOBOL4 example
This program counts the vowels in a string. Each pass of the loop deletes the first vowel it finds by replacing it with nothing; when no vowel is left, the match fails and control goes to DONE.
* Count the vowels in a line of text
LINE = 'THE QUICK BROWN FOX'
VOWELS = ANY('AEIOU')
N = 0
LOOP LINE VOWELS = :F(DONE)
N = N + 1 :(LOOP)
DONE OUTPUT = 'Vowels: ' N
END
Labels start in column one, other statements must be indented, and string concatenation is just a blank between two values. Success and failure, rather than true and false, drive the control flow.
Where SNOBOL was used
SNOBOL found its home wherever text mattered more than arithmetic. Researchers used it for concordances, text analysis and early computational linguistics. Compiler and macro-processor writers used it for prototyping, because parsing is pattern matching. Universities taught it in courses on string processing and programming languages throughout the 1970s.
Speed was the main complaint about the original interpreter, so Robert Dewar and Ken Belcher wrote SPITBOL ("SPeedy ImplemenTation of snoBOL"), first released in the early 1970s, a compiled implementation that ran SNOBOL4 programs many times faster. Macro SPITBOL later brought it to many architectures.
Influence and legacy
The clearest descendant is Icon, which generalised SNOBOL's success and failure into goal-directed evaluation. SNOBOL4 is also listed among the influences of AWK, and Lua's pattern library owes something to it. More broadly, the idea that text processing deserves first-class language support, later central to Perl, owes a real debt to SNOBOL.
Is SNOBOL still used today?
Only by enthusiasts and a few long-lived scripts. Phil Budne's CSNOBOL4 is a portable C port of the original Bell Labs implementation, and SPITBOL has been released as open source. Both run on modern Linux and other systems, so you can still learn how SNOBOL string pattern matching works hands-on, and many people find it an eye-opening contrast to regular expressions.
Frequently asked questions
Is SNOBOL pattern matching more powerful than regular expressions?
Yes. SNOBOL4 patterns support backtracking, recursion through deferred evaluation and side effects during matching, so they can describe context-free structures such as balanced parentheses. Classic regular expressions cannot. Modern regex engines have added some extensions, but SNOBOL4 had this power in the late 1960s.
What language replaced SNOBOL?
Ralph Griswold's own successor was Icon, released at the University of Arizona in 1977. For practical text processing, many users later moved to AWK and then Perl. Neither is a direct replacement, but they took over most of the jobs SNOBOL used to do.
Can I run SNOBOL4 programs on a modern computer?
Yes. CSNOBOL4 and the open-source SPITBOL both run on current operating systems, including Linux. Most classic SNOBOL4 programs from books and papers run with little or no change.







