Deforestation improvement

 

In spite of all these successive refinements and generalizations, one class of programs remains undeforested (e.g., tex2html_wrap_inline1735 and tex2html_wrap_inline1737 belong to this class). From our point of view, the following informal remarks could help to characterize this class.

Functional methods always use functors to drive transformations and computations, while symbolic composition and attribute grammars do not. The example of rev is meaningful:

displaymath1739

Let tex2html_wrap_inline1741 be the functor that drives the recursion of this function. tex2html_wrap_inline1741 does not follow the construction of the resulting list of reverse. But following the recursive calls of rev, it hides the construction of the result. More precisely, the constructor tex2html_wrap_inline1745 is hidden in the second parameter of the tex2html_wrap_inline1747 call. Because of this, no further deforestation can reach it.

In attribute grammars, symbolic composition catches each constructor of the result, directly from the specification. It does not need to do this using any particular abstract intermediate notion, such as functors. The reason is that all the result constructions, even if they do not follow the functor of the recursion, remain visible in an attribute grammar specification. We believe this is why symbolic composition is able to perform more deforestation. See for example the section 3.2 where the previous tex2html_wrap_inline1745 is deforested. To deforest such programs, functional approaches should use a functor that describes completely the result construction scheme, particularly taking into account accumulative parameters in which constructions or transmissions of -- parts of -- the result occur.

To conclude, one of the important contribution of this paper is to show that symbolic composition is actually a general deforestation method. Thanks to FP-to-AG, symbolic composition is no longer restricted to attribute grammars.



Web page maintained by Didier Parigot
Fri Feb 27 17:28:38 MET 1998