Node: Pattern Matching, Next: , Previous: Regular Expressions, Up: Standard Procedures



Pattern Matching

Pattern matching is a key feature of most modern functional programming languages since it allows clean and secure code to be written. Internally, "pattern-matching forms" should be translated (compiled) into cascades of "elementary tests" where code is made as efficient as possible, avoiding redundant tests; STKLOS's "pattern matching compiler" provides this 1. The technique used is described in details in [QueinnecGeffroy92], and the code generated can be considered optimal 2 due to the way this "pattern compiler" was obtained.

The "pattern language" allows the expression of a wide variety of patterns, including:


Footnotes

  1. The ``pattern matching compiler'' has been written by Jean-Marie Geffroy and is part of the Manuel Serrano's Bigloo compiler [Serrano01] since several years. The code (and documentation) included in STKLOS has been stolen from the Bigloo package v2.4 (the only difference between both package is the pattern matching of structures which is absent in STKLOS).

  2. In the cases of pattern matching in lists and vectors, not in structures for the moment.