 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
n |
Program
Transformer works as shown below:
|
|
|
|
u |
1.
Register pattern matching rules
|
|
|
|
F |
register_pattern(Expression
pat, Expression subst)
|
|
|
|
F |
register_pattern(Statement
pat, Statement subst)
|
|
|
|
• |
gpath
and gsubsth can be made by using AST package
|
|
|
|
• |
They
can include *not concern* node
|
|
|
|
u |
2.
Check if the sub-tree, whose root is specified (usually this),
|
|
matches
an existing pattern. If match, substitution is
|
|
|
performed.
|
|
|
|
F |
substitution(Expression
root)
|
|
|
|
F |
substitution(Statement
root)
|
|