Profile Symbolic Evaluation

 

The result of the preliminary transformation is not yet a real attribute grammar. Each function definition in the initial program has been translated into one block (cf. Figure 3) that contains the profile of the function and its related patterns. But explicit recursive calls have been translated into the form tex2html_wrap_inline1569 . Now, these expressions have to be transformed into a set of more detailed semantic rules, breaking explicit recursions by attribute naming and attachment to pattern variables. Then, semantic rules will implicitly define the recursion ``à la'' attribute grammar. This transformation is achieved by the profile symbolic evaluation, presented in Figure 5.

   figure501
Figure 5: Profile Symbolic Evaluation

Everywhere an expression tex2html_wrap_inline1569 occurs, the profile symbolic evaluation projects the semantic rules of the attribute grammar profile f. The application of this transformation must be done with a depth-first application strategy. The Check constraint ensures that the resulting attribute grammar is well formed. Essentially, it verifies that each attribute is defined once and only once. This is generally the case since parameters in input functional programs are well-defined, but Check forbid some non-linear terms such that tex2html_wrap_inline1587 . Moreover, in a first approach, terms like (x.a).b are not allowed but they will be treated in section 3.2. Wherever tex2html_wrap_inline1591 is not verified, the expression tex2html_wrap_inline1569 is simply rewrited in the function call tex2html_wrap_inline1595 .

In the previous flat example, the semantic rule associated to pattern node left right is

displaymath1597

The applicationgif of (PSE) rule on this semantic rule is:

displaymath1603

Finally, complete application of the profile symbolic evaluation leads for the function flat to the well-formed attribute grammar given below. The successive application of preliminary transformation and profile symbolic evaluation to an input functional program leads to a real attribute grammar. This is the FP-to-AG translation.

displaymath1605



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