The composition of a match and a build (in either order) can often be simplified. If the match following a build is incompatible, failure is certain. For example,
  !Foo(Bar(x), y); ?FooBar(z)
can be replaced with fail since the match will never succeed.

If the build and match are compatible (i.e., if they can be unified), the sequence can be simplified. For example,

  !Foo(Bar(x), y); ?Foo(z1, z2); ...
can be replaced with
  !Bar(x); ?z1; !y; ?z2; !Foo(Bar(x), y); ...
Subsequent transformations can get rid of the construction of the entire term, if it is not needed.

These ideas are implemented by simple rewrite rules in module

The rules are applied by the Stratego simplifier. Often these rules are triggered by inlining (which brings matches and builds together). The results are simplified by constant and copy propagation and dead variable elimination.

-- EelcoVisser - 18 Aug 2003

Revision: r1.1 - 18 Aug 2003 - 20:16 - EelcoVisser
Copyright © 1999-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback