Snobol is a high-level programming language developed in 1962-1967 and intended primarily for processing textual data .
The main goal of the Snobol language was to show the principle (the possibility of its full existence) that everything is a line . Externally, the language looks in the so-called “old style”: it is difficult to recognize modern ideas of procedures in it, however, its power is not inferior to LISP in working in an “artificial intelligence” environment.
Pattern matching based on BNF grammars . A fully dynamic language, including declarations, types, memory allocation, even entry and exit points. The implementation uses virtual string processing macros - simply rewriting macros for any existing computer.
The language, which is the language for writing compilers, in which the basic principle that everything is a string and has such an "ugly" syntax, could not naturally "degenerate" into a completely different, outwardly not even similar: Icon . Initially, it was just a superstructure over Snobol4, but soon became an independent programming language.
Content
History
Development began in 1962 by Ralph Griswold, Ivan Polonsky and David Farber, employees of AT&T Bell Labs. Their goal was to create a string processing language for working with formulas and analyzing graphs.
In 1950, MIT's Yngve (YIT) developed the COMIT language for natural language processing based on NSF rules, but the Bell Labs team found COMIT too limited for its purpose.
Initially, the language was called SCL7 (Symbolic Computation Language 7), then its name was changed to SEXI (String Expression Interpreter), which for obvious reasons was condemned in the 1960s , and finally it became known as SNOBOL (StriNg Oriented symBOlic Language) - artificially created acronym devoid of intuitive meaning. Several versions of the Snobol language have been developed - SNOBOL, SNOBOL2, SNOBOL3 and SNOBOL4. The latter was a success in the 1970s .
Example
Find among the input lines a palindrome composed of 0 and 1, the maximum odd length:
START GRAMMAR = 0 | 1 | 0 * GRAMMAR 0 | 1 * GRAMMAR 1
* Sets as an example the NBF grammar
LOOP NEWLINE - TRIMCINPUT): F (END)
* Gets the next line without trailing spaces.
* In case of error, switch to END.
NEWLINE (POS (0) SPAN ('0l ") PROS (0)): F (BAD)
* Checks a string for only zeros and ones.
* SPAN - a string of zeros and ones.
* POS (0) - the first position.
* PROS (0) is the last.
SN = SIZE (NEWLINE)
NEXT NEWLINE POS (0) GRAMMAR. PALINDROME POS (SN)
-: S (OK) F (NOTOK)
* The string is checked for grammar compliance through POS (SN)
* If the comparison fails, move to the last position.
* If successful, an answer is printed.
* Matched part assigned to PALINDROME
OK OUTPUT = "MATCH:" PALINDROME: (LOOP)
NOTOK SN = SN - 1: (NEXT)
BAD OUTPUT = "IMPROPER INPUT:" NEWLINE: (LOOP)
End
See also
- Icon
Links
- SNOBOL4.ORG: SNOBOL4 Resources unspecified . www.snobol4.org. Date of treatment January 5, 2016.
- SNOBOL4 and SPITBOL Information unspecified . www.snobol4.com. Date of treatment January 5, 2016.
- SNOBOL - article from the Mathematical Encyclopedia
Literature
Language Reviews in Books on Programming Languages in General
- Robert In Sebest. 2.9. Two early dynamic languages: APL and SNOBOL // Basic concepts of programming languages = Concepts of Programming Languages. - 5th ed. - M .: "Williams" , 2001. - S. 672. - ISBN 5-8459-0192-8 .
- Terence Pratt. Snobol 4 // Programming Languages: Development and Implementation = Programming Language Design and Implementation (PLDI). - 1-st ed .. - M .: Mir, 1979. - S. 483-516. - 573 p.
- Ralph E. Griswold. Xiii. SNOBOL Session // History of Programming Languages / Richard L. Wexelblat. - Academic Press, 1981. - S. 601-660. - 820 s. - (ACM monograph series). - ISBN 9780127450407 .
Language Guides
- Ralph E. Griswold, etc. Snobol 4 Programming Language . - 2-nd ed .. - Prentice Hall, 1971. - (Automatic Computation). - ISBN 9780138153731 . (translation by Griswold R., Podge J., Polonski I. Programming language Snobol-4. - Mir, 1980. - (Computer software). )
- Ralph E. Griswold. Macroimplementation of Snobol 4. - WHFreeman & Co Ltd, 1972. - ISBN 9780716704478 .
- Ralph E. Griswold. String and list processing in SNOBOL4; techniques and applications. - Prentice-Hall, 1975. - (Prentice-Hall series in automatic computation). - ISBN 9780138530105 .
- James F. Gimpel. Algorithms in SNOBOL4. - Wiley, 1976. - ISBN 9780471302131 .
- Susan Hockey. Snobol programming for the humanities. - Clarendon Press; Oxford University Press, 1985 .-- ISBN 9780198246763 .