Namespaces
Variants
Actions

Snobol

From Encyclopedia of Mathematics
Revision as of 17:02, 7 February 2011 by 127.0.0.1 (talk) (Importing text file)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

An algorithmic language designed for programming problems of processing symbolic information, that is, data represented by words over some alphabet. In the literature on programming, such words are called strings, and the symbols comprising them are called letters or tokens. Based on the original form of Snobol, which was developed in the early 1960-s, several versions of the language were created, of which the most stable proved to be Snobol-4. As in the case of Refal, Snobol has its own theoretical premise, Markov normal algorithms (cf. Normal algorithm), in which the basic computing operation is the detection in of a given substring and its subsequent replacement by another string .

The general structure of programs in Snobol is typical of that of algorithmic languages. A program has the form of a sequence of operators (instructions) of conferment, comparison with a model, substitution, control transmission, input, deduction, and halting. The primitive operations used in such expressions are predicates and functions and also functions defined by the programmer (including recursive definitions). Any instruction can be labelled. A label in Snobol can be treated as a line variable whose value is an instruction labelled by this label. Fundamental data types are lines, integers and real numbers, names, and models. The basic type is the line, and all other data have a line representation coinciding with the method for denoting them in the program. Homogeneous data can be combined in groups and tables, and arbitrary data in sets of a given length and with prescribed names for every position (field) of the set. Names denote variables, labels, formal parameters, and functions. Lines in Snobol can have arbitrary length. Variables do not have a type constantly attributed to them, although operands (cf. Operand) of every operation or primitive functions expect data of a specific type, transforming arguments to the expected type or issuing information about an error.

The most typical operation in Snobol is the comparison of a line with a model. A model is a special term in Snobol, creating in some sequence a group of control lines and a specific action of movement from left to right (scanning) along a prescribed line, called the subject. Comparison is a sequence of elementary checks. An elementary check establishes whether the next control line is a subline of the remainder (to the right of the scanning point) of the subject. Depending on the success or failure of an elementary check, there occurs either an elaboration of the information about the success or failure of the comparison on the whole, or a transfer to the next control line of the model and a transfer of the scanning point. As a result of a successful comparison, a sequence of sublines is chosen in the subject. These sublines can be conferred by the above variable or replaced by other sublines.

A primitive model is an expression whose value is a line, and the success of a comparison consists of the occurrence of this line in the subject. The concatenation or two models and creates a model, successful comparison with which requires success in the comparison with followed by success in comparison of the remainder of the subject with . The alternation of two models and creates a model with which successful comparison means success in comparison with either or . If is a model and a variable, then the construction denotes a model with which successful comparison preserves as the value of that control line whose occurrence in the subject led to the success.

The instruction of comparison with a model has the form , where is a variable-subject and a model. Conditional control transfer is represented by the instruction : , where and are the transfer labels in the case of failure and success of comparison, respectively. A substitution instruction has the form , where is a line expression whose value in a successful comparison replaces the selected subline in .

Snobol has a well-developed library of primitive functions which, in combination with the operations of concatenation and alternation, enables one to create voluminous models and to write compactly in the form of a replacement instruction very complex rules for the analysis and transformation of lines. Programs in Snobol are developed by a programming processor of interpretation type. A program is translated into an intermediate form which is executed with the aid of an interpreter. Snobol has been implemented on all main architectures of contemporary computers. The implementation of this language aided the development of efficient algorithms for manipulating lines of variable length in a computer memory.

References

[1] D.J. Farber, R.E. Griswold, I.P. Polonsky, "SNOBOL, a string manipulation language" J. Assoc. Comput. Mach. , 11 : 1 (1964) pp. 21–30
[2] R.E. Griswold, "String and list processing in SNOBOL 4. Techniques and applications" , Prentice-Hall (1975)
[3] R. Griswold, J. Poage, I. Polonsky, "The SNOBOL-4 programming language" , Prentice-Hall (1968)
How to Cite This Entry:
Snobol. Encyclopedia of Mathematics. URL: http://encyclopediaofmath.org/index.php?title=Snobol&oldid=48742
This article was adapted from an original article by A.P. Ershov (originator), which appeared in Encyclopedia of Mathematics - ISBN 1402006098. See original article