ABSTRACT
This paper presents a methodology for describing and implementing pattern matching in SNOBOL4. The basic element of the formulation is the coroutine. The coroutine notion permits a complete procedural implementation as well as a concise description of the pattern-matching process. Matching procedures are represented by co-routines whose order of invocation is determined from the tree structure of a given pattern. The context for a coroutine's operation maintains the details of a local matching process. Side effects that may require reversal in the event of backtracking are undone by the coroutine that caused the effect. The system described has been used to implement extensions to the existing pattern-matching facilities of SNOBOL4.
- 1.Griswold, R. E., J. F. Poage, and I. P. Polonsky. The SNOBOL4 Programming Language (2nd Ed.). Prentice-Hall, Englewood Cliffs, N.J., 1968. Google ScholarDigital Library
- 2.Griswold, Ralph E. The Macro Implementation of SNOBOL4. W.H. Freeman, San Francisco, 1972. Google ScholarDigital Library
- 3.Gimpel, J. F. "A Theory of Discrete Patterns and Their Implementation in SNOBOL4", Comm. ACM 16, 2 (Feb. 1973), 91-100. Google ScholarDigital Library
- 4.Doyle, John N. A New Approach to the Analysis and Synthesis of Strings, SNOBOL4 Project Document S4D38a. The University of Arizona, Tucson, Arizona. November 19, 1973.Google Scholar
- 5.Fisher, David A. Control Structures for Programming Languages. Ph.D. Th., Carnegie-Mellon University, Pittsburgh, Pa. May, 1970. Google ScholarDigital Library
- 6.Prenner, C., Spitzen, J., and Wegbreit, B. "An Implementation of Backtracking for Programming Languages".SIGPLAN Notices 7, 11 (Nov. 1972), 36-44. Google ScholarDigital Library
- 7.Bobrow, D. G. and Wegbreit, B."A Model and Stack Implementation of Multiple Environments", Comm. ACM 6, 10 (Oct. 1973), 591-603. Google ScholarDigital Library
- 8.Sussman, G. J. Winograd, T. and Chariak, E. MICRO-PLANNER Reference Manual. AI Memo 203A, MIT, Cambridge, Mass. Google ScholarDigital Library
Index Terms
- A procedural approach to pattern matching in SNOBOL4
Recommendations
Extensible pattern matching in SNOBOL4
ACM '75: Proceedings of the 1975 annual conferenceAlthough the string pattern-matching facilities of SNOBOL4 are the most powerful of those of any widely used programming language, they suffer both from complexity and lack of a mechanism for defining new scanning procedures. This paper describes a ...
The SL5 procedure mechanism
This paper describes an integrated procedure mechanism that permits procedures to be used as recursive functions or as coroutines. This integration is accomplished by treating procedures and their activation records (called environments) as data objects ...
Coroutines in FORTRAN
A method is described for using coroutines within the strict confines of ANSI FORTRAN. A FORTRAN preprocessor that has been implemented to transform FORTRAN programs, written as if coroutines were allowed, to standard ANSI FORTRAN programs is also ...
Comments