home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-386-Vol-2of3.iso / v / vsnbl220.zip / VANILLA.DOC < prev    next >
Text File  |  1991-11-01  |  13KB  |  317 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.                                    VANILLA SNOBOL4
  9.  
  10.             Vanilla SNOBOL4 provides the entire Bell Labs SNOBOL4 program-
  11.           ming language, except for real numbers and external functions.
  12.  
  13.             The total size of the object program and data cannot exceed 30K
  14.           bytes in this entry-level version.  Vanilla SNOBOL4 and the ac-
  15.           companying documentation are copyrighted materials.  However, it
  16.           may be copied and shared according to these terms:
  17.  
  18.             1. No fee greater than $10 is charged for use, copying or dis-
  19.                tribution.
  20.  
  21.             2. SNOBOL4.EXE and all documentation are not modified in any
  22.                way, and are distributed together.
  23.  
  24.             3. The manual may not be packaged with any other product.
  25.  
  26.             4. Neither SNOBOL4+ (our commercial product), nor its printed
  27.                manual, may be copied.
  28.  
  29.             Vanilla SNOBOL4 was released because we believe many people
  30.           would enjoy programming in SNOBOL4, if there was a version of the
  31.           language that was widely and freely available.  Contributions are
  32.           NOT requested.  Enjoy and share it!
  33.  
  34.             This file, VANILLA.DOC, provides an overview of the SNOBOL4
  35.           Programming Language, and why you'll find it to be an interesting
  36.           and useful tool.
  37.  
  38.  
  39.                             THE PHILOSOPHY OF SNOBOL4...
  40.  
  41.             Like most high-level computer languages, SNOBOL4 represents a
  42.           design philosophy.  C, for instance, was designed for power and
  43.           portability.  BASIC was designed for introducing students to com-
  44.           puters, and Pascal for teaching structured programming.
  45.  
  46.             SNOBOL4's designers felt that programming time and effort
  47.           should be minimized, even if the computer had to do additional
  48.           work.  The philosophy is to allow the programmer to focus on
  49.           solving the problem at hand, rather than on details like dynamic
  50.           memory allocation, variable typing, data conversion, and so on.
  51.  
  52.             If ease of use coupled with extraordinary power and versatility
  53.           appeals to you, please read on.
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.        VANILLA.DOC (V1.2)              - 1 -                    Catspaw, Inc.
  65.  
  66.  
  67.  
  68.  
  69.  
  70.                                THE STRING LANGUAGE...
  71.  
  72.             Almost uniquely among computer languages, SNOBOL4 treats a
  73.           string as a distinct data type, rather than as a sequence or
  74.           array of discrete characters.
  75.  
  76.             That's an abstraction.  Consider a concrete example to fill an
  77.           everyday need -- converting a WordStar file into an ASCII file.
  78.  
  79.             In most languages, your program would have to examine each
  80.           character in the WordStar file.  If its ASCII value is 127 or
  81.           below, the character is passed on; if above, then 128 is sub-
  82.           tracted.  Then the individual bytes have to be reassembled into a
  83.           string.
  84.  
  85.             Assuming that the input and output files have been designated
  86.           on the command line, the entire conversion program in SNOBOL4
  87.           looks like this:
  88.  
  89.                     &Alphabet LEN(128) . Normals LEN(128) . Highs
  90.             Loop    Output = REPLACE(Input, Highs, Normals)   :S(Loop)
  91.  
  92.             Notice how the REPLACE function operates on the entire string
  93.           at once?  Is there any other language that could do this conver-
  94.           sion in a two-line program?  How much time could you save by
  95.           writing data-conversion programs in SNOBOL4?
  96.  
  97.  
  98.                                THE PATTERN LANGUAGE...
  99.  
  100.             While SNOBOL4 provides a rich repertoire of string functions,
  101.           its other specialty is patterns.  Suppose, for instance, you have
  102.           a list of words, and you want to write out all those that start
  103.           with "b" or "d", followed by a vowel, and end in "ly".  Here's
  104.           the entire program:
  105.  
  106.           * Match at the start of a word and define a pattern:
  107.                &Anchor = 1
  108.                WantPat = ('b' | 'd') ANY('aeiou') RTAB(2) 'ly'
  109.           
  110.           * Read a line of input, perform the match, write results:
  111.           Fetch     Word = Input                  :F(End)
  112.                     Word WantPat                  :F(Fetch)
  113.                     Output = Word                 :(Fetch)
  114.           End
  115.  
  116.             SNOBOL4's syntax is so easy that you probably didn't need to
  117.           know it to understand this program.  A line can have a label, an
  118.           operation, or a goto, or any two, or all three.  Statements can
  119.           succeed or fail.  The goto can be conditional upon success or
  120.           failure.
  121.  
  122.             In the above program, a pattern is first defined.  At Fetch,
  123.           the input is assigned to the variable Word.  If that fails, the
  124.  
  125.  
  126.  
  127.        VANILLA.DOC (V1.2)              - 2 -                    Catspaw, Inc.
  128.  
  129.  
  130.  
  131.  
  132.  
  133.           program has run out of input, and the program stops by transfer-
  134.           ring to End.
  135.  
  136.             Next the word is compared to the pattern.  If that fails, the
  137.           program goes back to Fetch to get the next word.  If the opera-
  138.           tion succeeds, control goes to the next line, where Word is writ-
  139.           ten out, and a transfer made to Fetch to continue the loop.
  140.  
  141.             Pattern matching is a very-high level language concept.  Pat-
  142.           terns may be arbitrarily complex -- SNOBOL4 will search among the
  143.           many alternatives for a match.  Patterns may even be recursively
  144.           defined:
  145.  
  146.                LIST = ELEMENT | ELEMENT "," *LIST
  147.  
  148.  
  149.                                THE USEFUL LANGUAGE...
  150.  
  151.             The range of current uses for SNOBOL4 is as diverse as its
  152.           users.  Because programs can be written quickly for testing,
  153.           systems-level programmers use it for prototyping assemblers, com-
  154.           pilers and language translators.
  155.  
  156.             In many offices, the utilities for reformatting data and text
  157.           are short SNOBOL4 programs.  With its backtrack searching, recur-
  158.           sive abilities, and first-class data objects, SNOBOL4 is finding
  159.           a home in artificial-intelligence research.  Its pattern-matching
  160.           makes it a natural for querying data bases.
  161.  
  162.             Researchers use it for finding patterns in everything from
  163.           medieval music to DNA sequences.  Newspapers and print shops use
  164.           it for text formatting, translation and typesetting.  Others find
  165.           SNOBOL4 the perfect tool for one-shot "throw-away" programs.
  166.  
  167.             If the challenge before you is primarily non-numeric, the odds
  168.           are that you can use SNOBOL4 to meet that challenge more quickly
  169.           and easily than with any other language.
  170.  
  171.  
  172.                                THE ELEGANT LANGUAGE...
  173.  
  174.             SNOBOL4 is so powerful that its programs are typically quite
  175.           short.  Source programs are typical 5 to 10 TIMES smaller than
  176.           equivalent C or Pascal programs.
  177.  
  178.             SNOBOL4 allows an unlimited number of user-defined subroutines.
  179.           By relying upon them, you create programs of structure and ele-
  180.           gance.  Like patterns, subroutines may be recursive.  They're
  181.           also fast to write and easy to update, revise, and maintain.
  182.  
  183.  
  184.                             THE EASY-TO-LEARN LANGUAGE...
  185.  
  186.             Because SNOBOL4's syntax is so simple, it's easy to learn the
  187.  
  188.  
  189.  
  190.        VANILLA.DOC (V1.2)              - 3 -                    Catspaw, Inc.
  191.  
  192.  
  193.  
  194.  
  195.  
  196.           basics and be writing useful programs in just a few hours. Human-
  197.           ities professors love it because its short programs are simple to
  198.           explain to students without a computer background.
  199.  
  200.             But while it is easy to learn, it's not easy to exhaust.  The
  201.           concepts embodied -- patterns, success and failure, tables,
  202.           recursion, run-time code compilation -- will stimulate your
  203.           interest indefinitely.
  204.  
  205.             Whether you're a systems designer, software developer, language
  206.           enthusiast, end user, or the office PC guru, you can put SNOBOL4
  207.           to work immediately to make your time more productive.
  208.  
  209.  
  210.                               THE FLEXIBLE LANGUAGE...
  211.  
  212.             Not only can you create your own "language within a language"
  213.           with SNOBOL4's roll-your-own functions, but you can define your
  214.           own data types.
  215.  
  216.             As if that weren't flexibility enough, SNOBOL4 also allows you
  217.           to redefine or extend its operators during execution -- flexibil-
  218.           ity that few other languages dare to offer.
  219.  
  220.             In fact, you can create and execute new program segments at
  221.           runtime; programs can evolve based upon the data they are pro-
  222.           cessing.  It's trivial to write a SNOBOL4 program that reads,
  223.           compiles and executes other SNOBOL4 programs.  Try doing that in
  224.           BASIC or Pascal!
  225.  
  226.             One of SNOBOL4's most exquisite features is the TABLE.  In
  227.           essence, it's a one-dimensional array where the index can be any
  228.           data type.  You aren't limited to A[1] or the like; your table
  229.           can have indices like A["what"] or A[7.3].
  230.  
  231.             The table, almost unique to SNOBOL4, provides associative mem-
  232.           ory referencing -- so that data can be quickly stored and refer-
  233.           enced in its natural form.
  234.  
  235.  
  236.                         THE POWERFUL AND PORTABLE LANGUAGE...
  237.  
  238.             Beyond its specialties of string and pattern-matching, SNOBOL4
  239.           provides a full array of mathematical operations; it's a general-
  240.           purpose programming language.  Pointers, indirect-referencing and
  241.           user-defined data types permit arbitrary data structures such as
  242.           lists, trees, and networks.
  243.  
  244.             Because the SNOBOL4 language has been implemented on a wide
  245.           range of mainframe and mini-computer systems, programs can be
  246.           developed and tested on a desktop machine, then easily ported to
  247.           the bigger computers, generally with no modification.
  248.  
  249.  
  250.  
  251.  
  252.  
  253.        VANILLA.DOC (V1.2)              - 4 -                    Catspaw, Inc.
  254.  
  255.  
  256.  
  257.  
  258.  
  259.                              THE UPGRADEABLE LANGUAGE...
  260.  
  261.             If you become a SNOBOL4 fan, you'll want SNOBOL4+, our $125 pro-
  262.           fessional version (plus shipping).  It allows programs and data
  263.           up to 300K, assembly-language functions, real numbers, and has
  264.           dozens of extensions like: binary and random-access I/O, include
  265.           files, built in Shell sort, Spitbol operators, SAVE files and
  266.           royalty-free runtime, dozens of new functions and keywords and a
  267.           symbolic debugger.  It interfaces easily to specialized systems
  268.           and components, such as Novell's Btrieve(tm) file management
  269.           package.  You can find more information about SNOBOL4+ in the
  270.       file SNOBOL4.DOC.
  271.  
  272.             SNOBOL4+ includes a 240-page printed and indexed manual, and
  273.           over 70 files of sample programs and functions.  SNOBOL4+ is not
  274.           a public-domain product, and it may not be copied (except for le-
  275.           gitimate backup purposes).  The printed manual may not be copied.
  276.  
  277.             SNOBOL4+ owners also get telephone and written support, should
  278.       you ever have a question about SNOBOL4 programming.
  279.  
  280.             We carry all SNOBOL4 books in print, from beginner to advanced.
  281.           Also available is SPITBOL, a high-performance 32-bit implementation
  282.       of the SNOBOL4 language with execution speeds 6 to 10 times FASTER
  283.       than SNOBOL4+.  Versions are available for MS-DOS 80386/486, OS/2
  284.       2.0, Apple Macintosh, Sun 4/SPARC, and many 680x0 UNIX workstations.
  285.  
  286.             Enjoy this taste of SNOBOL4, the standard for text manipula-
  287.           tion, pattern-matching, and fun programming.  We hope you develop
  288.           an appetite.
  289.  
  290.           CATSPAW, INC.   P.O. BOX 1123   SALIDA, COLORADO 81201   USA
  291.  
  292.             Telephone:   (719) 539-3884
  293.             FAX:         (719) 539-4830
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.           ____________________
  311.  
  312.             (tm) Unix is a registered trademark of AT&T
  313.  
  314.  
  315.  
  316.        VANILLA.DOC (V1.2)              - 5 -                    Catspaw, Inc.
  317.