You are on page 1of 11

SNOBOL

• StriNg Oriented SymBOlic Language


• Special purpose language for string
manipulation and handling
• Invented in 1962 at the Bell Labs
• Farber, Griswold, and Polensky
• It was created out of the frustrations of
working with the languages of the that time
because they required the developers to
write large programs to do a single
operation
Application
• It was used to do most of the work in designing
new software and interpreting different language
grammars
• Toward the end of the eighties, newer languages
were created which could also be used for string
manipulation
• They include the PERL and AWK languages.
Unlike SNOBOL, Perl and Awk use regular
expressions to perform the string operations
• Today, roughly forty years after its release, the
language is rarely used!
Simple Data Types
• Integers and Strings
• Integers; positive or negative
14 -234 0 0012 +12832 -9395 +0
Illegal: 49723 - 3,076
• Reals; originally not allowed (e.g 13.4)
• Strings
Maximum length of a string is 5,000
characters
Simple Operators
• Unary vs. Binary
 -6
 4-1
 more on it later
• Assignment Operator
 =
• Arithmetic Operators
 + - * / **
• Parentheses
Variables
• The name of a variable must begin with an
upper or lower case letter
• The language is ‘case insensitive’
• If it is more than one character long, the
remaining characters may be any combination of
letters, numbers, or the characters ‘.’ (period)
and ‘_’ (underscore)
• The name may not be longer than the maximum
length of a line (120 characters)
Variables

• Examples:
 WAGER
 wager
 P23
 VerbClause
 SUM.OF.SQUARES
 Verb_Clause
 Illegal
 _clause
Snobol
Snobol Statement
Statement Structure
Structure

Label Statement body :GOTOField

• Label
– Must begin in the first character position of a statement
– Must start with a letter or a number
Snobol
Snobol Statement
Statement Structure
Structure

• The GOTO Field


 :(label)
 :S(label)
 :F(label)
 :S(label1) F(label2)
Types of Statements
• Assignment
• Pattern Matching
• Replacement
• End
Assignment Statement
variable = value
v=5 Spaces around arithmetic
operators are necessary
w.1 = v
w = 14 + 3 * -2

No Spaces; Unary
operator!
Strings
v = ‘Dog’
v = “Cat’s”
NULL =

You might also like