Rewriting: Program vs. Pattern Matching

Rewriting of symbolic expressions can be accomplished by an ad hoc program, or by using pattern matching and rewrite rules. Each has advantages and disadvantages:


  1. Adv.: Often is more efficient. Avoids restrictions that may be present with patterns.

  2. Dis.: The rewriting program becomes large. Hard to find errors, omissions.

Pattern Matching:

  1. Adv.: Declarative representation. Easier to understand. Mistakes less likely.

  2. Dis.: May be slower.
A good compromise may be to use a pattern matcher in combination with programs for those cases that are simple or are not easily handled by patterns.

Contents    Page-10    Prev    Next    Page+10    Index