Abstract
A technique is presented for the efficient incremental evaluation
of attribute grammars. Through its generality, the applied approach
may be affective too in the evaluation of higher order attribute
grammars. The authors' approach is an extension of a simpler algorithm
for incremental evaluation, where functions, corresponding to visit
sequences, are cached. Consequently, attributes are either found
in the cache or they are recomputed, so there is no longer need to
represent the attributed tree explicitly. One may share common subtrees,
avoiding repeated attribute evaluation, thus solving a typical HAG
problem. The authors propose the following change: instead of explicitly
representing the tree and calling visit sequence functions to compute
the attributes, the tree is represented through a set of visit functions
corresponding to the successive visits. These functions are constructed
using the visit sequences as building blocks. This technique has
two major advantages. Firstly, a visit function characterizes precisely
that part of the tree that would actually have been visited in the
previous approach, thus increasing the number of cache hits. Secondly,
copyrules may be removed during the construction phase. This results
in shortcircuiting copychains and in minimizing the number of recomputed
functions.
Users
Please
log in to take part in the discussion (add own reviews or comments).