EEL

EEL is a collection of functions and macros to facilitate exploratory mathematics in the field of formal language theory. It uses a declarative programming style to describe patterns over sequences and uses a backtracking search to find such a pattern. It also allows arbitrary constraints on the match.

The pattern matcher is an extension of the POSIX-style regular expressions in that it can match over any kind of sequence (even files and generator functions are allowed), can generate all possible matches, uses symbolic backreferences that are lexically scoped within provided language constructs, and pattern descriptions can match multiple sequences with dependencies between them.

For example, the following pattern description matches palindromes.

(pattern [x a y] where a = _? and (equal x (reverse y)))

Note that this does not work on (all) arrays, since equal does not check for structural equality.

An example of a more complex pattern used with a program would be

(defun overlap-compress (s1 s2)
  (pif (([a x] where a = _*? then [x b]) s1 s2) (concat a x b)))

This finds the longest suffix of 's1' that is also a prefix of 's2'. Note that 'a' is made to match lazily so that 'x' is matched to the longest suffix.

Using EEL

Once EEL is loaded, you must change to the EEL package to make use of it.

More documentation for EEL can be found at http://www.csd.uwo.ca/~wozniak/eel.

Download ASDF package from http://www.csd.uwo.ca/~wozniak/eel/eel-latest.tar.gz


This page is linked from: pattern matching  

CLiki pages can be edited by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively