What is a Macro Tree Transducer?Macro tree transducers were introduced by Engelfriet in [Engelfriet, 1980]. They combine the features of top-down tree transducers [Rounds, 1970] and Fischer's macro grammars [Fischer, 1968]. The first extensive investigation can be found in [Engelfriet and Vogler, 1985]. Deterministic macro tree transducers are investigated in detail in [Fülöp and Vogler, 1998], where they are compared with other formal models of syntax-directed semantics. In principle, macro tree transducers consist of rules, each of them meaning to transform a node of the input tree depending on the node's label. Subsequent functions are called for the children of the transformed node. This means, a macro tree transducer can be considered as a recursive first-order functional program generating trees, where the choice of functions is triggered by top-down pattern matching an input tree. During a computation, macro tree transducers may accumulate intermediate results in additional parameters, and thus have access to context information. Compared to the top-down tree transducer, the ability of carrying context information to further processing steps makes the macro tree transducer the more expressive model. Formally, a stay macro tree transducer is defined as follows. Definition A stay macro tree transducer M is defined by (Q,Σ,Q0,R), where
A similar definition can be found in [Maneth, Perst, and Seidl, 2007]. In [Perst, 2007]. additionally a formal definition of the semantics can be found. Since the function calls in right-hand sides can be nested, one has to carefully distinguish between inside-out and outside-in evaluation, because in general, both evaluation modes lead to different results. The evaluation of a stay macro tree transducer M begins at the root node of the input. Given an input tree s0, M starts to process by evaluating one of its initial functions for the root node of s0. A function q∈Q with actual accumulating parameters t1,...,tk is applied to a subtree s=a(s1,...,sk) by carrying out the following steps. First, it is nondeterministically chosen one of the rules q(a(x1,..., xn), y1,... yk) → t or q(x0, y1,... yk) → t', for function q. If we have chosen a stay-rule, the current input tree s is substituted for the input variable x0 and the actual parameter tj for the accumulating variable yj in the right-hand side t. Otherwise, we substitute the subterms si and tj for the variables xi and yj in t'.
|