Bővebb ismertető
Foreword
SNOBOL4 is a computer programming language containing many features not commonly found in other programming languages. It evolved from SNOBOL [1,2,3]*, a language for string manipulation, developed at Bell Telephone Laboratories, Incorporated, in 1962. Extensions to SNOBOL through various versions have made it a useful tool in such areas as compilation techniques, machine simulation, symbolic mathematics, text preparation, natural language translation, linguistics, and music analysis.
The basic data element of SNOBOL4 is a string of characters, such as this line of printing. The language has operations for joining and separating strings, for testing their contents, and for making replacements in them. If a string is a sentence, it can be broken into phrases or words. If it is a formula, it can be taken apart into components and reassembled in another format. A string can appear either as a literal or as the value of a variable. The literal form is indicated by enclosing the string in quotation marks:
'THIS IS A STRING'
The string value may be assigned to a variable: LINE = 'THIS IS A STRING'
A common operation on a string is examination of its contents for a desired structure of characters. This structure, known as a pattern, can be as simple as a string or a given number of characters. A pattern also can be an extremely complicated expression consisting, for example, of a number of alternatives followed by another set of alternatives, all of which must begin a given number of characters from the end of the string. The pattern, as a data type, may also appear either in literal or variable form. The data type of a variable - string, pattern, or any other in the language - depends on the last value assigned to it. There are no type declaration statements for variables as in other programming languages.
SNOBOL4 provides numerical capabilities with both integers and real numbers. Because the language is essentially character oriented, and since most numerical operations involve character counting, integers are more commonly used. Conversion among integers, real numbers, and strings representing integers or real numbers is performed automatically as required. The programmer may, in addition, define other data types, such as complex numbers, and provide operations for them.
Often it is desirable to associate a group of items with one variable name through numerical indexing or some other identifying property. The SNOBOL4 array and table provide these capabilities with more flexibility than most programming languages. An
* Numbers in brackets refer to references listed at the end of this manual.