Compilation of non-linear, second order patterns on S-expressions
- First Online:
- Cite this paper as:
- Queinnec C. (1990) Compilation of non-linear, second order patterns on S-expressions. In: Deransart P., Maluszyński J. (eds) Programming Language Implementation and Logic Programming. PLILP 1990. Lecture Notes in Computer Science, vol 456. Springer, Berlin, Heidelberg
Pattern matching is a key concept for rule-based expert systems. Simple pattern interpreters appear in nearly every book on Lisp. Pattern matching is also a useful tool for case analyses as provided by functional languages such as ML or Miranda™. These two uses are somewhat different since functional languages emphasize a discrimination based on types while Lisp, or Plasma, make use of S-expressions or segments of S-expressions within patterns. The paper presents an intermediate language for patterns and its denotational semantics. This reduced language is powerful enough to express boolean composition of patterns as well as segment handling and unbounded pattern repetition. A compiler is then defined which translates patterns into functional code. We discuss some compilation variant as well as the integration of the pattern sub-language into Lisp. These capabilities make pattern matching an useful and efficient tool for a wide class of applicative languages and allow to incorporate into patterns more knowledge about the form or gestalt of the data to be matched.
Unable to display preview. Download preview PDF.