next up previous contents index
Next: tdb: the TSF debugger Up: Pattern-Matching Facilities Previous: Pattern-Matching grammar

Pattern Abstractors

A pattern abstractor is a function that takes as input a pattern and produces a new pattern that will match more Fortran statement than the input pattern. More formally an abstractor absOp is defined as follow


\begin{displaymath}\forall~F,~\forall~P \in \{ Pattern \},P(F) => absOp(P)(F)
\end{displaymath}

where F is a set of Fortran statements. A non exhaustive list of the current abstractors in the system are the following:

  $\blacktriangleright$ Name and constant generalization:
 
Anonymous variable names are used by the pattern-matcher instead of using their current values;
  $\blacktriangleright$ Loop structure:
 
The pattern corresponding to the end of a loop is replaced by a segment-pattern (see table 4) that will match any end loop structure (enddo, continue, label statement, ...);

  $\blacktriangleright$ Body extension:
 
The pattern corresponding to the body of a statement is generalized to accept other statements;

  $\blacktriangleright$ Assignment statement simplification:
 
The pattern corresponding to an assignment statement is replaced by a pattern that matches any expressions on the left and right hand sides of the assignment.

For instance, applying the pattern abstractor on the code at the top of the example 67, generalizes the pattern corresponding strictly to the Fortran code fragment into a pattern that accepts any variable names and constants. Thus we automatically compute a pattern that matches all loops with a similar syntactic code structure. Of course, the pattern, produced automatically, can then be edited by the user when needed.

All the variables defined in the pattern may be used like some pointers on the subtrees matched at the transformation script level.

$\vartriangleright$ Example 67:Pattern abstractor  

10, j, 1, ... have respectively been replaced by ?v161, ?v162, ?v163, ..., which may be associated to any kind of constants or variables.


next up previous contents index
Next: tdb: the TSF debugger Up: Pattern-Matching Facilities Previous: Pattern-Matching grammar
Yann Mevel
1999-04-30