next up previous contents index
Next: Optimizing Tree Rewriting Up: Tree Rewriting Previous: Confluence and termination

Debugging Tree Rewriting

By default, Prop generates a macro DEBUG_C for each rewrite class named C. The user can redefine this macro in order to trace the replacements that are performed during the execution of a set of rewriting rules. The default definition of DEBUG_C is as follows:
#define DEBUG_C(R,redex,filename,linenumber,ruletextR

i.e. it simply returns the value of R.

The arguments to the macro are as follows:

In order to activate tracing, the user can redefine the macro DEBUG_FOO (for rewrite class FOO) as follows:

#define DEBUG_FOO(a,b,c,d,e) print_rule(a,b,c,d,e)

template <class T>
  T print_rule(T replacement, T redex,
               const char * file_name,
               int line, const char * rule_text)
  { cerr << file_name << ':' << line << ": " << rule_text
         << " redex = " << redex << " replacement = " << replacement
         << endl;
    return replacement;
  }
Note that these definitions must appear before the rewrite FOO declaration.



Allen Leung
Mon Apr 7 14:33:55 EDT 1997