SlideShare a Scribd company logo
-41-
A SOLUTION TO THE GREAT BIG SUBSTITUTION PROBLEM:
Subject Modification During Pattern Matching in SNOBOL4
Bill N. Schilit
Center for Computing Activities
Columbia University
New York, N,Y 10027
ABSTRACT
In a recent SIGPLAN article [1] a
major deficiency in the SNOBOL4
programming language was exposed
and one possible solution
suggested. The SNOBOL4 language
shortcomming, dubbed "the great big
substitution problem", involves
replacing substrings in the subject
string° This article describes an
alternative modification to
SNOBOL4, which allows replacement
of a matched substring of the
subject during pattern matching,
along with some ideas on
implementation.
i. INTRODUCTION
SNOBOL4 has been depicted as a language for use in text
editing [i], viewed as such however, the language has one
essential deficiency. The problem which epitomizes SNOBOL's
failing has been coined "the great big substitution problem" [6].
This problem involves replacing every occurrence of "great" with
-42-
'gbig~ in a string°
Although there are many valid ways to program this problem in
SNOBOL, all involve an unusual amount of effort on the part of
the programmer to achieve an efficient algorithm° The intuitive
one line solution:
LOOP LINE "great '~ = "big '~ :S(LOOP)
has a major defect which manifests itself when the pattern
contains a subs,ring of the object° When this condition arises
as in:
LOOP LINE "great" = "greater" :S(LOOP)
the subject string expands around the first "great" with the
result of "greater", "greaterer", "greatererer", o.., until the
string exceeds the memory capacity of even the greatest computer.
A better solution involves finding a "great", making the
replacement, and for the next scan of the subject, tabbing over
to where the last match was found. This prevents SNOBOL from
rescanning a part of the subject for an occurrence of "great". A
similar solution involves chopping the subject into two strings,
one that has been processed, and one that is still to be scanned.
The subject for the "great" search then, will always be the
unprocessed string, and the final result will be the
concatenation of the two strings.
Other programmed solutions have been offered, such as breaking
the string into many pieces and recombining them through
concatenation [i]. All these solutions however share two
undesirable properties: inefficiency and difficulty to program.
The operation of replacing substrings of a subject string is
common enough in a string oriented language, and certainly in an
editing language, to necessitate a simple and efficient solution,
therefore some extension to the SNOBOL4 language is necessary.
2. SUBJECT STRING REPLACEMENT DURING PATTERN MATCHING
What is required is a construct that is easily implemented,
following the general style of the language, and most important,
one that offers a maximum of flexibility.
The great big substitution problem can be viewed as the
inability of SNOBOL4 to modify the subject during the pattern
matching operation. Valid assignment operations during pattern
matching only include assigning subs,rings of the subject to
variables. Both the immediate assignment operator "$" and the
-43-
conditional assignment operator "°" are used for this type of
operation, What is suggested is a construct similar to dot and
dollar sign which allows replacement of a matched substring of
the subject with a another string.
In a restricted sense this operation already exists, it is the
replacement statement:
subject pattern = object
where pattern matching is performed and if the match succeeds
then the subject string is modified by replacing the matched
substring by the object. The replacement statement is one of the
earliest constructs in SNOBOL [3] and has changed little in the
lifetime of the language. This statement however, contains few
of the finer properties of value assignment: the conditional and
immediate properties, and the positional independence.
The most notable drawback to the replacement statement is that
the modification occurs after pattern matching and not during;
this means of course that matching cannot proceed after a
modification has taken place and that the environment of the
match, e.g. the cursor position and the pattern history stack,
have been lost. One solution then, is to make the modification
within the pattern match phase.
3. SYNTAX
The syntax for this proposed subject replacement is intended
to be compatible with the standard syntax of SNOBOL4 and consists
of two new binary operators. These are "<." for conditional
subject modification and "<$" for immediate modification. The
"less than" symbol may be pictured as pointing to the subject
whose value is being altered. The dollar sign and dot are
borrowed from the immediate and conditional value assignments.
For example replacing every occurrence of "BIG" with "GREAT"
could be:
BIG.LINE "BIG" <$ "GREAT" FAIL
The "<$" immediately replaGes the substring of the subject
defined by the pattern with the object, and updates the cursor
position to allow for resulting expansion or shrinkage. FAIL
causes the scanner to seek alternatives which in unanchored mode
means the active pattern is retried starting further into the
subject.
It might also be desirable to introduce a construct such as
FAIL(n), which causes the scanner to seek alternatives the first
-44-
n times it is called~ like FAILs and on the n+lst time just
returns° FAIL(n) can then be used to replace the first 21
occurrences of "big ~ with ~great':
BIG.LINE "BIG" <$ "GREAT '~ FAIL(21)
The conditional modification operator '~<o" is similar~ except
that the modifications are stacked during pattern matching and
performed only after a successful matching phase°
4. IMPLEMENTATION CONSIDERATIONS
This section describes implementation considerations for a
particular version of SNOBOL4 written at the Stevens Institute of
Technology called SITBOL [7, 8]. SITBOL runs on the Digital
Equipment Corporation's DECsystem-10 and DECsystem-20 computers,
both 36 bit machines. The data structures in SITBOL however are
similar to those described by Griswold [4, 5] and also by Dewar
[2].
4.1. PRELIMINARY STRUCTURES
In SITBOL character strings are stored in contiguous regions
called string blocks. To simplify diagramming, string blocks are
denoted by enclosing the text in braces. In order to access the
string block a special structure called a qualifier is used. The
qualifier for a string block has four fields: an identifying
integer (F field), a pointer to the string block (V field), an
offset and length (0 and L fields). The offset specifies the
beginning character position of the string and the length denotes
the length of the string. By employing offsets it is possible to
referer to substrings stored in the string block. A diagram of a
string block qualifier is shown in figure 4-1. The value for the
F field is some integer which defines the descriptor as a string
block qualifier.
I F I v i
I o I L I
Figure 4-1: Format of a String Block Qualifier
For example, employing the brace notation for string blocks, a
qualifier for the string "any text" might appear as in figure 4-
2. Where the offset into the string block is zero, and the
-45-
length of the string is seven. SBLKQ represents the unique
integer in the place of the F field which specifies that this is
a string block qualifier.
I SBLKQ I
I 0. I
~------~{any text here}
7. ]
Figure 4-2: A Qualifier for "any text"
The algorithm for conditional subject modification is
essentially the same as the existing method employed for
conditional assignment. This method involves pushing onto a
stack the qualifier for the matched substring along with a
qualifier for the object. Each time a conditional replacement is
made, a pair of qualifiers is pushed onto the stack. If the
pattern match succeeds then the qualifiers are popped and
replacements are made. If the pattern fails then the information
on the stack is discarded.
4.2. SEGMENTED STRING BLOCKS
Unfortunately immediate subject modification poses a more
substantial problem; the subject must always reflect changes
immediately. One method is to recreate the subject string after
every assignment is made. This however is prohibitively time
consuming. To facilitate immediate replacement during pattern
matching a new data structure, the segmented string block, is
proposed.
A segmented string block is a structure which allows a string
to span string blocks. The segmented qualifier points to a list
of segmented blocks, which are similar to string qualifiers
except a field is reserved for a link to the next segment block.
In diagram 4-2 SGBLQ is the code denoting a segmented string
qualifier, and SGBLK is the code denoting a segment block.
Notice that a field is reserved in the qualifier to store the
total length of the string. In the string block qualifier the
total length is available in the L field. To get the total
length of the string in a segmented structure however, it would
be necessary to traverse the linked list summing all the L
fields. Hence for quick reference it is desirable to maintain a
field to store the total string length. If the implementor finds
it useful there is also room for a backpointer.
-46-
Descriptor :
I SGBLQ I T°t L I
I I
• Segment Block:
SGBLKI -- I
0 I L
I
I
ment Block:
I SGBLK I
I o I L I
I Nil I I
~ {Any string of value}
~{Anything else}
Figure 4-3: Segmented String Descriptors
5. A FINAL EXAMPLE
AS a final example consider the structures before and after
the immediate subject modification in the statements:
LINE = "The great great problem"
LINE "great" <$ "big" FAIL
Before pattern matching the data might be represented by string
block qualifiers as in figure 5-1.
After pattern matching the structures for the subject might
appear as in figure 5-2. The resulting subject is "The big big
problem". Notice that no new strings have been created. When the
pattern matching is complete it may be desirable to build a
standard string from the segmented string. This operation,
however, is not necessary. The implementor should recognize that
all functions that deal with strings need to be rewritten or
modified to handle the new structure.
-47-
SBLKQ
0° 23°
SBLKQ
--~----~{The great great problem}
J
0o 3.
{big }
l
Figure 5-1: Structures Before Pattern Matching
6° CONCLUSION
Aside from the replacement of one string with another, subject
modification offers other advantages. Using the immediate
modification operator "<$" allows the use of a modified subject
string in the remaining statement. The nature of the binary
operators allow for any number of modifications of the subject
according to any number of patterns. Many operations which
involve matching and assigning variables can be accomplished in
fewer statements, making programs more concise.
Although the real functionality of subject modification
remains to be seen, this enhancement to SNOBOL appears to be an
extremely powerful facility. Because of the similarity to
existing structures the two operators should be easy to implement
and easily accepted by programmers.
7. ACKNOWLEDGMENTS
I would like to thank Andrew Lowry and Frank da Cruz for an
abundance of encouragement, and Dr. Howard Eskin and Vace
Kundakci who suggested the FAIL(n) construct and reviewed an
early draft making many valuable suggestions.
-48-
I SGBLDI 19, I
I
I
I
I 0° i 4. I
l I l
....
~{The great great
SGBLK I i
'
" ~ {big }
0. I 3. I
I I
SGBLK I 11
9. I i. I
I I
problem}
~{The great_great problem}
.~r{The great great problem}
•iSGB~K I I,r ~{bi~}
I 0. I 3. I
I
SGBLK ] I
I
i 15. I 8. J
I Nil ] I
Figure 5-2: Structure After Pattern Matching
-49-
[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]
REFERENCES
Blatt, D.W.E.
On The Great Big Substitution Problem.
ACM SIGPLAN Notices 15(6):19-27, June, 1980.
Dewar, Robert B. K.
SPITBOL Version 2.0
Illinois Institute of Technology Publication, 1971.
Also see source code listings.
Farber, D.J., R.E. Griswold, and I.P Polonsky.
SNOBOL, A String Manipulation Language.
Journal of the ACM 11(1):21-30, January, 1964.
Griswold, Ralph E. .
SNOBOL4 -- Structure and Implementation.
Technical Report, Bell Telephone Laboratories,
Incorporated, August, 1971.
Presented at SHARE XXXVII, New York City, August 12, 1971.
Griswold, Ralph E.
The Macro Implementation of SNOBOL4.
W.H. Freeman and Company, San Francisco, 1971.
Hext, J.B.
Pattern Matching Commands.
In J. Tobias (editor), Proc. Symposium on Language Design
and Programming Methodology, pages 105-110. AAEC Press,
1979.
Gimpel, James F.
Sitbol Documentation
Stevens Institute of Technology, 1976.
Distributed with SITBOL.
SITBOL-20 Documentation
Columbia Center for Computing Activities, 1981.
Distributed with SITBOL-20.

More Related Content

Similar to A Solution To The Great Big Substitution Problem

Analysis of LDPC Codes under Wi-Max IEEE 802.16e
Analysis of LDPC Codes under Wi-Max IEEE 802.16eAnalysis of LDPC Codes under Wi-Max IEEE 802.16e
Analysis of LDPC Codes under Wi-Max IEEE 802.16e
IJERD Editor
 
C interview questions
C interview questionsC interview questions
C interview questions
Soba Arjun
 
A lexisearch algorithm for the Bottleneck Traveling Salesman Problem
A lexisearch algorithm for the Bottleneck Traveling Salesman ProblemA lexisearch algorithm for the Bottleneck Traveling Salesman Problem
A lexisearch algorithm for the Bottleneck Traveling Salesman Problem
CSCJournals
 
A Domain-Specific Embedded Language for Programming Parallel Architectures.
A Domain-Specific Embedded Language for Programming Parallel Architectures.A Domain-Specific Embedded Language for Programming Parallel Architectures.
A Domain-Specific Embedded Language for Programming Parallel Architectures.
Jason Hearne-McGuiness
 
Compact binary-tree-representation-of-logic-function-with-enhanced-throughput-
Compact binary-tree-representation-of-logic-function-with-enhanced-throughput-Compact binary-tree-representation-of-logic-function-with-enhanced-throughput-
Compact binary-tree-representation-of-logic-function-with-enhanced-throughput-
Cemal Ardil
 
Oopsla02 behavioralsemantics.ppt
Oopsla02 behavioralsemantics.pptOopsla02 behavioralsemantics.ppt
Oopsla02 behavioralsemantics.ppt
Yann-Gaël Guéhéneuc
 
17515
1751517515
Google Objective-C Style Guide
Google Objective-C Style GuideGoogle Objective-C Style Guide
Google Objective-C Style Guide
Winston Hsieh
 
Google Objective-C Style Guide
Google Objective-C Style GuideGoogle Objective-C Style Guide
Google Objective-C Style Guide
Winston Hsieh
 
Finite_Element_Analysis_with_MATLAB_GUI
Finite_Element_Analysis_with_MATLAB_GUIFinite_Element_Analysis_with_MATLAB_GUI
Finite_Element_Analysis_with_MATLAB_GUI
Colby White
 
Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)
IJERD Editor
 
Finite element analysis sdfa ggq rsd vqer fas dd sg fa sd qadas casdasc asdac...
Finite element analysis sdfa ggq rsd vqer fas dd sg fa sd qadas casdasc asdac...Finite element analysis sdfa ggq rsd vqer fas dd sg fa sd qadas casdasc asdac...
Finite element analysis sdfa ggq rsd vqer fas dd sg fa sd qadas casdasc asdac...
MrGChandrasekarmecha
 
C Languages FAQ's
C Languages FAQ'sC Languages FAQ's
C Languages FAQ's
Sriram Raj
 
C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1
ReKruiTIn.com
 
Iaetsd 128-bit area
Iaetsd 128-bit areaIaetsd 128-bit area
Iaetsd 128-bit area
Iaetsd Iaetsd
 
Planet of the AOPs
Planet of the AOPsPlanet of the AOPs
Planet of the AOPs
James Ward
 
EVOLUTION OF STRUCTURE OF SOME BINARY GROUP-BASED N-BIT COMPARATOR, N-TO-2N D...
EVOLUTION OF STRUCTURE OF SOME BINARY GROUP-BASED N-BIT COMPARATOR, N-TO-2N D...EVOLUTION OF STRUCTURE OF SOME BINARY GROUP-BASED N-BIT COMPARATOR, N-TO-2N D...
EVOLUTION OF STRUCTURE OF SOME BINARY GROUP-BASED N-BIT COMPARATOR, N-TO-2N D...
VLSICS Design
 
A step-by-step guide to writing a simple package that uses S4 methods a hel...
A step-by-step guide to writing a simple package that uses S4 methods  a  hel...A step-by-step guide to writing a simple package that uses S4 methods  a  hel...
A step-by-step guide to writing a simple package that uses S4 methods a hel...
Lori Mitchell
 
DB2 Interview Questions - Part 1
DB2 Interview Questions - Part 1DB2 Interview Questions - Part 1
DB2 Interview Questions - Part 1
ReKruiTIn.com
 
Buffer overflow attack
Buffer overflow attackBuffer overflow attack
Buffer overflow attack
Prithiviraj Prithiviraj
 

Similar to A Solution To The Great Big Substitution Problem (20)

Analysis of LDPC Codes under Wi-Max IEEE 802.16e
Analysis of LDPC Codes under Wi-Max IEEE 802.16eAnalysis of LDPC Codes under Wi-Max IEEE 802.16e
Analysis of LDPC Codes under Wi-Max IEEE 802.16e
 
C interview questions
C interview questionsC interview questions
C interview questions
 
A lexisearch algorithm for the Bottleneck Traveling Salesman Problem
A lexisearch algorithm for the Bottleneck Traveling Salesman ProblemA lexisearch algorithm for the Bottleneck Traveling Salesman Problem
A lexisearch algorithm for the Bottleneck Traveling Salesman Problem
 
A Domain-Specific Embedded Language for Programming Parallel Architectures.
A Domain-Specific Embedded Language for Programming Parallel Architectures.A Domain-Specific Embedded Language for Programming Parallel Architectures.
A Domain-Specific Embedded Language for Programming Parallel Architectures.
 
Compact binary-tree-representation-of-logic-function-with-enhanced-throughput-
Compact binary-tree-representation-of-logic-function-with-enhanced-throughput-Compact binary-tree-representation-of-logic-function-with-enhanced-throughput-
Compact binary-tree-representation-of-logic-function-with-enhanced-throughput-
 
Oopsla02 behavioralsemantics.ppt
Oopsla02 behavioralsemantics.pptOopsla02 behavioralsemantics.ppt
Oopsla02 behavioralsemantics.ppt
 
17515
1751517515
17515
 
Google Objective-C Style Guide
Google Objective-C Style GuideGoogle Objective-C Style Guide
Google Objective-C Style Guide
 
Google Objective-C Style Guide
Google Objective-C Style GuideGoogle Objective-C Style Guide
Google Objective-C Style Guide
 
Finite_Element_Analysis_with_MATLAB_GUI
Finite_Element_Analysis_with_MATLAB_GUIFinite_Element_Analysis_with_MATLAB_GUI
Finite_Element_Analysis_with_MATLAB_GUI
 
Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)
 
Finite element analysis sdfa ggq rsd vqer fas dd sg fa sd qadas casdasc asdac...
Finite element analysis sdfa ggq rsd vqer fas dd sg fa sd qadas casdasc asdac...Finite element analysis sdfa ggq rsd vqer fas dd sg fa sd qadas casdasc asdac...
Finite element analysis sdfa ggq rsd vqer fas dd sg fa sd qadas casdasc asdac...
 
C Languages FAQ's
C Languages FAQ'sC Languages FAQ's
C Languages FAQ's
 
C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1
 
Iaetsd 128-bit area
Iaetsd 128-bit areaIaetsd 128-bit area
Iaetsd 128-bit area
 
Planet of the AOPs
Planet of the AOPsPlanet of the AOPs
Planet of the AOPs
 
EVOLUTION OF STRUCTURE OF SOME BINARY GROUP-BASED N-BIT COMPARATOR, N-TO-2N D...
EVOLUTION OF STRUCTURE OF SOME BINARY GROUP-BASED N-BIT COMPARATOR, N-TO-2N D...EVOLUTION OF STRUCTURE OF SOME BINARY GROUP-BASED N-BIT COMPARATOR, N-TO-2N D...
EVOLUTION OF STRUCTURE OF SOME BINARY GROUP-BASED N-BIT COMPARATOR, N-TO-2N D...
 
A step-by-step guide to writing a simple package that uses S4 methods a hel...
A step-by-step guide to writing a simple package that uses S4 methods  a  hel...A step-by-step guide to writing a simple package that uses S4 methods  a  hel...
A step-by-step guide to writing a simple package that uses S4 methods a hel...
 
DB2 Interview Questions - Part 1
DB2 Interview Questions - Part 1DB2 Interview Questions - Part 1
DB2 Interview Questions - Part 1
 
Buffer overflow attack
Buffer overflow attackBuffer overflow attack
Buffer overflow attack
 

More from Karla Adamson

Cover Essay Tulisan
Cover Essay TulisanCover Essay Tulisan
Cover Essay Tulisan
Karla Adamson
 
Political Science Research Paper Outline. Free Politica
Political Science Research Paper Outline. Free PoliticaPolitical Science Research Paper Outline. Free Politica
Political Science Research Paper Outline. Free Politica
Karla Adamson
 
Essay Professional Essay Writing Services And How T
Essay Professional Essay Writing Services And How TEssay Professional Essay Writing Services And How T
Essay Professional Essay Writing Services And How T
Karla Adamson
 
Essay Writing Website Reviews - The Oscillation Band
Essay Writing Website Reviews - The Oscillation BandEssay Writing Website Reviews - The Oscillation Band
Essay Writing Website Reviews - The Oscillation Band
Karla Adamson
 
003 Essay Example Grading Rubric Synthesisqkeythings Page Thatsnotus
003 Essay Example Grading Rubric Synthesisqkeythings Page Thatsnotus003 Essay Example Grading Rubric Synthesisqkeythings Page Thatsnotus
003 Essay Example Grading Rubric Synthesisqkeythings Page Thatsnotus
Karla Adamson
 
List Of Scholarships 2021 - Schoolarship
List Of Scholarships 2021 - SchoolarshipList Of Scholarships 2021 - Schoolarship
List Of Scholarships 2021 - Schoolarship
Karla Adamson
 
BPG Indian Font This BPG Indian Font Styl
BPG Indian Font This BPG Indian Font StylBPG Indian Font This BPG Indian Font Styl
BPG Indian Font This BPG Indian Font Styl
Karla Adamson
 
A Friend In Need Is A Friend Indeed Essay English Handwriting
A Friend In Need Is A Friend Indeed Essay English HandwritingA Friend In Need Is A Friend Indeed Essay English Handwriting
A Friend In Need Is A Friend Indeed Essay English Handwriting
Karla Adamson
 
What Is A Essay Map - Premier Unique School Writings And Services
What Is A Essay Map - Premier Unique School Writings And ServicesWhat Is A Essay Map - Premier Unique School Writings And Services
What Is A Essay Map - Premier Unique School Writings And Services
Karla Adamson
 
How To Write On Black Paper With
How To Write On Black Paper WithHow To Write On Black Paper With
How To Write On Black Paper With
Karla Adamson
 
Tips On Writing GMAT AWA Essays
Tips On Writing GMAT AWA EssaysTips On Writing GMAT AWA Essays
Tips On Writing GMAT AWA Essays
Karla Adamson
 
Writing Assignment 2
Writing Assignment 2Writing Assignment 2
Writing Assignment 2
Karla Adamson
 
The Top Ten Academic Writing Accounts (Both Har
The Top Ten Academic Writing Accounts (Both HarThe Top Ten Academic Writing Accounts (Both Har
The Top Ten Academic Writing Accounts (Both Har
Karla Adamson
 
How To Word A Thesis. Format
How To Word A Thesis. FormatHow To Word A Thesis. Format
How To Word A Thesis. Format
Karla Adamson
 
Guide To Writing Basic Essay
Guide To Writing Basic EssayGuide To Writing Basic Essay
Guide To Writing Basic Essay
Karla Adamson
 
Scholarship Essay Descripti
Scholarship Essay DescriptiScholarship Essay Descripti
Scholarship Essay Descripti
Karla Adamson
 
016 Essay Example Expository Prompts That
016 Essay Example Expository Prompts  That016 Essay Example Expository Prompts  That
016 Essay Example Expository Prompts That
Karla Adamson
 
Buy Writing Paper For Kids Handwriting Practice Pape
Buy Writing Paper For Kids  Handwriting Practice PapeBuy Writing Paper For Kids  Handwriting Practice Pape
Buy Writing Paper For Kids Handwriting Practice Pape
Karla Adamson
 
Top Online Essay Writing Help From Best Premium Writers
Top Online Essay Writing Help From Best Premium WritersTop Online Essay Writing Help From Best Premium Writers
Top Online Essay Writing Help From Best Premium Writers
Karla Adamson
 
Great Writing 2 Great Paragraphs (Edition
Great Writing 2 Great Paragraphs (EditionGreat Writing 2 Great Paragraphs (Edition
Great Writing 2 Great Paragraphs (Edition
Karla Adamson
 

More from Karla Adamson (20)

Cover Essay Tulisan
Cover Essay TulisanCover Essay Tulisan
Cover Essay Tulisan
 
Political Science Research Paper Outline. Free Politica
Political Science Research Paper Outline. Free PoliticaPolitical Science Research Paper Outline. Free Politica
Political Science Research Paper Outline. Free Politica
 
Essay Professional Essay Writing Services And How T
Essay Professional Essay Writing Services And How TEssay Professional Essay Writing Services And How T
Essay Professional Essay Writing Services And How T
 
Essay Writing Website Reviews - The Oscillation Band
Essay Writing Website Reviews - The Oscillation BandEssay Writing Website Reviews - The Oscillation Band
Essay Writing Website Reviews - The Oscillation Band
 
003 Essay Example Grading Rubric Synthesisqkeythings Page Thatsnotus
003 Essay Example Grading Rubric Synthesisqkeythings Page Thatsnotus003 Essay Example Grading Rubric Synthesisqkeythings Page Thatsnotus
003 Essay Example Grading Rubric Synthesisqkeythings Page Thatsnotus
 
List Of Scholarships 2021 - Schoolarship
List Of Scholarships 2021 - SchoolarshipList Of Scholarships 2021 - Schoolarship
List Of Scholarships 2021 - Schoolarship
 
BPG Indian Font This BPG Indian Font Styl
BPG Indian Font This BPG Indian Font StylBPG Indian Font This BPG Indian Font Styl
BPG Indian Font This BPG Indian Font Styl
 
A Friend In Need Is A Friend Indeed Essay English Handwriting
A Friend In Need Is A Friend Indeed Essay English HandwritingA Friend In Need Is A Friend Indeed Essay English Handwriting
A Friend In Need Is A Friend Indeed Essay English Handwriting
 
What Is A Essay Map - Premier Unique School Writings And Services
What Is A Essay Map - Premier Unique School Writings And ServicesWhat Is A Essay Map - Premier Unique School Writings And Services
What Is A Essay Map - Premier Unique School Writings And Services
 
How To Write On Black Paper With
How To Write On Black Paper WithHow To Write On Black Paper With
How To Write On Black Paper With
 
Tips On Writing GMAT AWA Essays
Tips On Writing GMAT AWA EssaysTips On Writing GMAT AWA Essays
Tips On Writing GMAT AWA Essays
 
Writing Assignment 2
Writing Assignment 2Writing Assignment 2
Writing Assignment 2
 
The Top Ten Academic Writing Accounts (Both Har
The Top Ten Academic Writing Accounts (Both HarThe Top Ten Academic Writing Accounts (Both Har
The Top Ten Academic Writing Accounts (Both Har
 
How To Word A Thesis. Format
How To Word A Thesis. FormatHow To Word A Thesis. Format
How To Word A Thesis. Format
 
Guide To Writing Basic Essay
Guide To Writing Basic EssayGuide To Writing Basic Essay
Guide To Writing Basic Essay
 
Scholarship Essay Descripti
Scholarship Essay DescriptiScholarship Essay Descripti
Scholarship Essay Descripti
 
016 Essay Example Expository Prompts That
016 Essay Example Expository Prompts  That016 Essay Example Expository Prompts  That
016 Essay Example Expository Prompts That
 
Buy Writing Paper For Kids Handwriting Practice Pape
Buy Writing Paper For Kids  Handwriting Practice PapeBuy Writing Paper For Kids  Handwriting Practice Pape
Buy Writing Paper For Kids Handwriting Practice Pape
 
Top Online Essay Writing Help From Best Premium Writers
Top Online Essay Writing Help From Best Premium WritersTop Online Essay Writing Help From Best Premium Writers
Top Online Essay Writing Help From Best Premium Writers
 
Great Writing 2 Great Paragraphs (Edition
Great Writing 2 Great Paragraphs (EditionGreat Writing 2 Great Paragraphs (Edition
Great Writing 2 Great Paragraphs (Edition
 

Recently uploaded

BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
Wahiba Chair Training & Consulting
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
Nguyen Thanh Tu Collection
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
EduSkills OECD
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 

A Solution To The Great Big Substitution Problem

  • 1. -41- A SOLUTION TO THE GREAT BIG SUBSTITUTION PROBLEM: Subject Modification During Pattern Matching in SNOBOL4 Bill N. Schilit Center for Computing Activities Columbia University New York, N,Y 10027 ABSTRACT In a recent SIGPLAN article [1] a major deficiency in the SNOBOL4 programming language was exposed and one possible solution suggested. The SNOBOL4 language shortcomming, dubbed "the great big substitution problem", involves replacing substrings in the subject string° This article describes an alternative modification to SNOBOL4, which allows replacement of a matched substring of the subject during pattern matching, along with some ideas on implementation. i. INTRODUCTION SNOBOL4 has been depicted as a language for use in text editing [i], viewed as such however, the language has one essential deficiency. The problem which epitomizes SNOBOL's failing has been coined "the great big substitution problem" [6]. This problem involves replacing every occurrence of "great" with
  • 2. -42- 'gbig~ in a string° Although there are many valid ways to program this problem in SNOBOL, all involve an unusual amount of effort on the part of the programmer to achieve an efficient algorithm° The intuitive one line solution: LOOP LINE "great '~ = "big '~ :S(LOOP) has a major defect which manifests itself when the pattern contains a subs,ring of the object° When this condition arises as in: LOOP LINE "great" = "greater" :S(LOOP) the subject string expands around the first "great" with the result of "greater", "greaterer", "greatererer", o.., until the string exceeds the memory capacity of even the greatest computer. A better solution involves finding a "great", making the replacement, and for the next scan of the subject, tabbing over to where the last match was found. This prevents SNOBOL from rescanning a part of the subject for an occurrence of "great". A similar solution involves chopping the subject into two strings, one that has been processed, and one that is still to be scanned. The subject for the "great" search then, will always be the unprocessed string, and the final result will be the concatenation of the two strings. Other programmed solutions have been offered, such as breaking the string into many pieces and recombining them through concatenation [i]. All these solutions however share two undesirable properties: inefficiency and difficulty to program. The operation of replacing substrings of a subject string is common enough in a string oriented language, and certainly in an editing language, to necessitate a simple and efficient solution, therefore some extension to the SNOBOL4 language is necessary. 2. SUBJECT STRING REPLACEMENT DURING PATTERN MATCHING What is required is a construct that is easily implemented, following the general style of the language, and most important, one that offers a maximum of flexibility. The great big substitution problem can be viewed as the inability of SNOBOL4 to modify the subject during the pattern matching operation. Valid assignment operations during pattern matching only include assigning subs,rings of the subject to variables. Both the immediate assignment operator "$" and the
  • 3. -43- conditional assignment operator "°" are used for this type of operation, What is suggested is a construct similar to dot and dollar sign which allows replacement of a matched substring of the subject with a another string. In a restricted sense this operation already exists, it is the replacement statement: subject pattern = object where pattern matching is performed and if the match succeeds then the subject string is modified by replacing the matched substring by the object. The replacement statement is one of the earliest constructs in SNOBOL [3] and has changed little in the lifetime of the language. This statement however, contains few of the finer properties of value assignment: the conditional and immediate properties, and the positional independence. The most notable drawback to the replacement statement is that the modification occurs after pattern matching and not during; this means of course that matching cannot proceed after a modification has taken place and that the environment of the match, e.g. the cursor position and the pattern history stack, have been lost. One solution then, is to make the modification within the pattern match phase. 3. SYNTAX The syntax for this proposed subject replacement is intended to be compatible with the standard syntax of SNOBOL4 and consists of two new binary operators. These are "<." for conditional subject modification and "<$" for immediate modification. The "less than" symbol may be pictured as pointing to the subject whose value is being altered. The dollar sign and dot are borrowed from the immediate and conditional value assignments. For example replacing every occurrence of "BIG" with "GREAT" could be: BIG.LINE "BIG" <$ "GREAT" FAIL The "<$" immediately replaGes the substring of the subject defined by the pattern with the object, and updates the cursor position to allow for resulting expansion or shrinkage. FAIL causes the scanner to seek alternatives which in unanchored mode means the active pattern is retried starting further into the subject. It might also be desirable to introduce a construct such as FAIL(n), which causes the scanner to seek alternatives the first
  • 4. -44- n times it is called~ like FAILs and on the n+lst time just returns° FAIL(n) can then be used to replace the first 21 occurrences of "big ~ with ~great': BIG.LINE "BIG" <$ "GREAT '~ FAIL(21) The conditional modification operator '~<o" is similar~ except that the modifications are stacked during pattern matching and performed only after a successful matching phase° 4. IMPLEMENTATION CONSIDERATIONS This section describes implementation considerations for a particular version of SNOBOL4 written at the Stevens Institute of Technology called SITBOL [7, 8]. SITBOL runs on the Digital Equipment Corporation's DECsystem-10 and DECsystem-20 computers, both 36 bit machines. The data structures in SITBOL however are similar to those described by Griswold [4, 5] and also by Dewar [2]. 4.1. PRELIMINARY STRUCTURES In SITBOL character strings are stored in contiguous regions called string blocks. To simplify diagramming, string blocks are denoted by enclosing the text in braces. In order to access the string block a special structure called a qualifier is used. The qualifier for a string block has four fields: an identifying integer (F field), a pointer to the string block (V field), an offset and length (0 and L fields). The offset specifies the beginning character position of the string and the length denotes the length of the string. By employing offsets it is possible to referer to substrings stored in the string block. A diagram of a string block qualifier is shown in figure 4-1. The value for the F field is some integer which defines the descriptor as a string block qualifier. I F I v i I o I L I Figure 4-1: Format of a String Block Qualifier For example, employing the brace notation for string blocks, a qualifier for the string "any text" might appear as in figure 4- 2. Where the offset into the string block is zero, and the
  • 5. -45- length of the string is seven. SBLKQ represents the unique integer in the place of the F field which specifies that this is a string block qualifier. I SBLKQ I I 0. I ~------~{any text here} 7. ] Figure 4-2: A Qualifier for "any text" The algorithm for conditional subject modification is essentially the same as the existing method employed for conditional assignment. This method involves pushing onto a stack the qualifier for the matched substring along with a qualifier for the object. Each time a conditional replacement is made, a pair of qualifiers is pushed onto the stack. If the pattern match succeeds then the qualifiers are popped and replacements are made. If the pattern fails then the information on the stack is discarded. 4.2. SEGMENTED STRING BLOCKS Unfortunately immediate subject modification poses a more substantial problem; the subject must always reflect changes immediately. One method is to recreate the subject string after every assignment is made. This however is prohibitively time consuming. To facilitate immediate replacement during pattern matching a new data structure, the segmented string block, is proposed. A segmented string block is a structure which allows a string to span string blocks. The segmented qualifier points to a list of segmented blocks, which are similar to string qualifiers except a field is reserved for a link to the next segment block. In diagram 4-2 SGBLQ is the code denoting a segmented string qualifier, and SGBLK is the code denoting a segment block. Notice that a field is reserved in the qualifier to store the total length of the string. In the string block qualifier the total length is available in the L field. To get the total length of the string in a segmented structure however, it would be necessary to traverse the linked list summing all the L fields. Hence for quick reference it is desirable to maintain a field to store the total string length. If the implementor finds it useful there is also room for a backpointer.
  • 6. -46- Descriptor : I SGBLQ I T°t L I I I • Segment Block: SGBLKI -- I 0 I L I I ment Block: I SGBLK I I o I L I I Nil I I ~ {Any string of value} ~{Anything else} Figure 4-3: Segmented String Descriptors 5. A FINAL EXAMPLE AS a final example consider the structures before and after the immediate subject modification in the statements: LINE = "The great great problem" LINE "great" <$ "big" FAIL Before pattern matching the data might be represented by string block qualifiers as in figure 5-1. After pattern matching the structures for the subject might appear as in figure 5-2. The resulting subject is "The big big problem". Notice that no new strings have been created. When the pattern matching is complete it may be desirable to build a standard string from the segmented string. This operation, however, is not necessary. The implementor should recognize that all functions that deal with strings need to be rewritten or modified to handle the new structure.
  • 7. -47- SBLKQ 0° 23° SBLKQ --~----~{The great great problem} J 0o 3. {big } l Figure 5-1: Structures Before Pattern Matching 6° CONCLUSION Aside from the replacement of one string with another, subject modification offers other advantages. Using the immediate modification operator "<$" allows the use of a modified subject string in the remaining statement. The nature of the binary operators allow for any number of modifications of the subject according to any number of patterns. Many operations which involve matching and assigning variables can be accomplished in fewer statements, making programs more concise. Although the real functionality of subject modification remains to be seen, this enhancement to SNOBOL appears to be an extremely powerful facility. Because of the similarity to existing structures the two operators should be easy to implement and easily accepted by programmers. 7. ACKNOWLEDGMENTS I would like to thank Andrew Lowry and Frank da Cruz for an abundance of encouragement, and Dr. Howard Eskin and Vace Kundakci who suggested the FAIL(n) construct and reviewed an early draft making many valuable suggestions.
  • 8. -48- I SGBLDI 19, I I I I I 0° i 4. I l I l .... ~{The great great SGBLK I i ' " ~ {big } 0. I 3. I I I SGBLK I 11 9. I i. I I I problem} ~{The great_great problem} .~r{The great great problem} •iSGB~K I I,r ~{bi~} I 0. I 3. I I SGBLK ] I I i 15. I 8. J I Nil ] I Figure 5-2: Structure After Pattern Matching
  • 9. -49- [1] [2] [3] [4] [5] [6] [7] [8] REFERENCES Blatt, D.W.E. On The Great Big Substitution Problem. ACM SIGPLAN Notices 15(6):19-27, June, 1980. Dewar, Robert B. K. SPITBOL Version 2.0 Illinois Institute of Technology Publication, 1971. Also see source code listings. Farber, D.J., R.E. Griswold, and I.P Polonsky. SNOBOL, A String Manipulation Language. Journal of the ACM 11(1):21-30, January, 1964. Griswold, Ralph E. . SNOBOL4 -- Structure and Implementation. Technical Report, Bell Telephone Laboratories, Incorporated, August, 1971. Presented at SHARE XXXVII, New York City, August 12, 1971. Griswold, Ralph E. The Macro Implementation of SNOBOL4. W.H. Freeman and Company, San Francisco, 1971. Hext, J.B. Pattern Matching Commands. In J. Tobias (editor), Proc. Symposium on Language Design and Programming Methodology, pages 105-110. AAEC Press, 1979. Gimpel, James F. Sitbol Documentation Stevens Institute of Technology, 1976. Distributed with SITBOL. SITBOL-20 Documentation Columbia Center for Computing Activities, 1981. Distributed with SITBOL-20.