next up previous contents index
Next: Rewriting rules Up: Tree Rewriting Previous: Conditional rewriting and

Rewrite class

 

The syntax of a rewrite class declaration is as follows:

Rewrite_Class_Decl ::=rewrite class Id  ( TypeExp, ¼ , TypeExp )
    [ : Inherit_List ] [ :: Rewrite_Mode ¼ Rewrite_Mode ]
    { Class_Body } ;
Rewrite_Mode ::=treeparser
  |  applicative
  |  topdown

This is simply the usual C++ class declaration syntax extended to the following information:

a traversal list
enclosed in parenthesis. The traversal list of a rewrite class defines the set of types that rewriting should traverse. If a datatype object contains an argument of a type not listed in the traversal list, its value will not be altered.
rewrite mode
this defines the rewriting mode of the rewrite class.



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