Snobol4-tut-gpp-2ed.pdf

(3651 KB) Pobierz
he SNOBOL4 Programming Language
he SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
The SNOBOL4 Programming Language
THE
SNOBOL
4
PROGRAMMING
LANGUAGE
second edition
R. E. Griswold
J. F. Poage
I. P. Polonsky
second edition
THE
SNOBOL
4
PROGRAMMING
LANGUAGE
R. E. Griswold
J. F. Poage
I. P. Polonsky
Bell Telephone Laboratories, Incorporated
Prentice-Hall, Inc., Englewood Cliffs, New Jersey
Reprinted electronically in 2005 by Ron Stephens & Catspaw, Inc.
by permission of AT
&
T.
Copyright © Bell Telephone Laboratories, Incorporated, 1971, 1968
Permission is granted to make and distribute verbatim
copies of this book provided the copyright notice and
permission notice are preserved on all copies.
(Originally published by Prentice Hall, Inc., ISBN 13-815373-6)
Library of Congress Catalog Card Number: 70-131996
Printed in the United Stated of America
World Wide Web sites for additional SNOBOL4 material:
Catspaw, Inc.
Phil Budne’s SNOBOL4 resources
www.SNOBOL4.com
www.SNOBOL4.org
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.
iii
Zgłoś jeśli naruszono regulamin