This is a review of the book “THE SNOBOL4 PROGRAMMING LANGUAGE (Second Edition)” by
The work resides in the category of canonical introductions to a programming language – not only for reason of being written by co-inventors of the language, but also very nicely so! Consider this: already the foreword presents a few core concepts of the language, setting the tone for the subsequent easy-going tour through SNOBOL’s constructs and mechanisms. Chapter 1 offers a quick guide to the most common elements, for the later chapters to each dive into the typical aspects of a language in more detail.
A reader gets confronted with the particularities of the string-processing language rather early. As pattern matching, extraction of matched substrings, replacement and concatenation are operations of primary concern, there’s no syntactical operator or explicit typing supplied for these, and instead their effect and internal type is implied from the arrangement within an execution statement form. Any string can be used as a pattern to match for, or be combined into a more complex rule grammar of alternative matching routes, which then is a first-order object. The logistics is handled by using variable assignment for reading input, writing output and for obtaining results from the execution of such statements. A statement may specify optional gotos on success or failure to another labeled statement for control flow transfer. Therefore, no if, else or loop construct can be found, as conditional jumps are performed depending on the result of the execution of the statement (which may contain the evaluation of operator expressions or predicate functions, either producing null or a non-null value). To support these operations, a number of built-in functions and settings are provided – some for adjusting the behavior of the pattern matcher, others for obtaining characters collected from partial match paths, others to generate certain patterns, and so on. Data types are addressed late, because most type conversions happen automatically.
Occasionally, the authors hint at the internal workings of the language implementation for the purpose of conveying a general notion of what is happening under the hood in order to help programmers with formulating statements that are correct, and, if needed, sufficiently efficient in terms of execution time and memory consumption. As strings are frequently handled, they’re stored in a globally unique fashion. This saves the time of creating copies, but if not using indirect reference address comparison to check for equality, each manipulation incurs the runtime cost of looking up whether the string does already exist or not. Manually calling the garbage collector, “fencing”/“anchoring” a partial match route to not go back to seek for other alternatives, globally disabling input/output if not needed (saves the check on whether a variable is bound to a device or not) or trimming whitespace characters are some of the optimization techniques. The conceptual model of the pattern matcher is neatly illustrated by a series of bead diagrams. Similarly, recursion (indicating automatic propagation of the stack with the temporary variables that are local to the function) is explained via a diagram that shows the nested function invocation. In various places, the functions EVAL, APPLY and CODE are discussed, as these allow evaluation of non-static expressions and compilation/interpretation of code at run-time, meaning: valid code strings can be generated and executed dynamically, which may contain input data and/or may depend on current variable state that was unknown at compile-time.
Several small parts of the book are clearly outdated. This is primarily caused by the need to enable users to develop programs for the computers of the day – here the IBM System/360 as the main target, while also supporting other machines by other vendors. This is not a huge flaw, as the language constructs are mostly universal and could likely map into new bindings to modern environments and machinery. Interfacing in the language itself might still remain usable, for example: loading and calling functions from external libraries should be more or less the same (in regard to a host language, system call or remote procedure call technique), despite this may not necessarily map into Fortran IV or an assembly library. Likewise, input/output is done per binding variables to devices, but this might no longer necessarily involve or require the Job Control Language, paper printer, magnetic tape, punch card reader or punch card puncher. Initial setup is beyond the scope of the book anyway, as the programmer would likely not be the person to install SNOBOL in the computer center in the first place. Many of the oddities in the language environment are caused by the baked-in assumption that programs are run on batch jobs of processing the data fed in from a series of punch cards: features like cancelling the compilation only after the 50ᵗʰ compile-time error, proceeding with the execution until a user-defined maximum of run-time errors is exceeded, per default printing out the program listing on program start and tracing being built-in, are reasonable if there’s no monitor for inspection, no personal/exclusive/interactive user session, and each compilation as well as execution on a batch of input is expensive (getting the results from the nightly job run the next day, just to learn that it failed early in the process). It’s rather beneficial that the publication includes actual program printout, so readers can learn about the language even without having access to a computer or a SNOBOL4 installation at their disposal. It is very apparent that SNOBOL started out for scripting small text processing tasks, and while various powerful mechanisms are made available (sufficient to be general-purpose, Turing-complete), it’s not really designed or fit for developing larger packages or applications.
The typesetting in a Century typeface is a pleasant improvement for this “second edition” (covering SNOBOL4 version 3) over the “first edition” (about SNOBOL4 version 2), as the latter has everything in monospace. One appendix outlines the differences between the two language versions – 3 being an extension on top of the version 2 subset offers good forward-compatibility, potentially after a few minor adjustments to mitigate changes in behavior. In the other direction not so much, as code written according to version 3 may face more significant issues if run under version 2, for reason of semantic extension of the version 2 subset in version 3. Another important appendix gives the syntax grammar specification for the language in a grammar notation said to be common in “many IBM manuals”, but, surprisingly, it’s not Extended Backus-Naur Form, just somewhat similar. Appendix C is example programs together with their execution printout, including a syntactical recognizer for SNOBOL4 code, two implementations for dealing with arbitrarily long numbers (either as string or for arithmetic, one using a linked list data structure), an implementation of a topological sort algorithm according to CONVERT is not on page 120, and instead it’s on page 122. On page 147, the chapter header is off, as “Conversion to PATTERN” starts on the next page (even if an intentional choice with old layout designs, a “preview” for the next page isn’t much useful). The running header doesn’t carry the chapter number, and references into other chapters don’t provide the page number. That is to say, the issues are with the references, which are not entirely ideal for navigating the material, but this can be excused by the typesetting affordances at the time, as well as the book serving as an introductory read, therefore it’s OK to not also being fully perfect as a lookup reference. The form factor and font size are rather nice and generous, bordering towards dimensions that are a little bit too large, but given it’s a flexible, flappy softcover, this works out just fine and invites to the casual, enjoyable, light overview over a programming language, which otherwise could be a heavy and convoluted topic.
While SNOBOL4 is a dead language not used anymore to create much new software, it may still remain of some interest to programming language designers, as it’s a member of the string processing group of languages and not from the more popular families of list processing or ALGOL/C/structured languages. The intriguing provocation to designers is, if and what innovation could still be introduced to the notational user interface (nonetheless should not diverge too far from the somewhat common “standard” shared across most languages) together with corresponding implementation affordances in order to support particularly prominent use-cases, without degrading into a domain-specific language. As the book stops just short of expanding the syntactical analyzer example to generate code objects or an abstract syntax tree in memory to pass it into CODE for execution, the user is kept protected from breaking changes made to the internal structures, and only SNOBOL syntax is exposed as stable programming interface for the interpreter at runtime – thus not entering into interpreter building matters, despite some of the parsing is naturally already there from text processing and pattern rule grammars. In general, SNOBOL doesn’t strictly follow today’s typical separation of language concern modularization, but this is because being this early in time (same issue with FORTRAN), and one could easily “clean up” the user space pollution by non-scoped built-in functions and reserved global names. On the other hand, pattern rule expression objects getting control logic attached on top of them on evaluation within a statement is a very clever first-order construct, also avoiding the usual mess of Unix regex with its abbreviated hieroglyphic grammar syntax.
Overall, this is an excellent book for both audiences: for those seeking an easy entry to SNOBOL4 version 3, as well as for readers who are interested in concept alternatives for pattern matching grammar expressions and/or programming language design.
Via Zeitfracht Medien GmbH’s print-on-demand service, a reproduction is kept available by Mijnbestseller.nl with ISBN NULL = '' is given as NULL =, which leaves to wonder what other differences do not faithfully resemble the original. It’s also not a replica because of the smaller form factor (hence more handy for travel). The layout is off to the left leaving more margin to the right, too on all the odd pages, which is somewhat annoying.
Copyright (C) 2026