Pattern matching is the process of
matching an input against a
given pattern. If the input and pattern match,
then some action
can be taken, such as conversion of the input to a new form using
an output pattern.

Pattern matching can be done in several steps:

Test whether the input matches the pattern. Keep bindings
between variables in the pattern and parts of the input.

Make the output: create a version of the output pattern with
substitutions from the input as appropriate.

Keep trying: one transformation may enable another, so continue until
the result does not change. (This is called a fixed point .)