This paper presents a new algorithm for the incremental evaluation of Ordered Attribute Grammars (OAGs), which also solves the problem of the incremental evaluation of Ordered Higher order Attribute Grammars (OHAGs). Two new approaches are used in the algorithm. First, instead of caching all results of semantic functions in the grammar, all results of visits to trees are cached. There are no attributed trees, because all attributes are stored in the cache. Trees are build using hash consing, thus sharing multiple instances of the same tree and avoiding repeated attributions of the same tree with the same inherited attributes. Second, each visit computes not only synthesized attributes but also bindings for subsequent visits. Bindings, which contain attribute values computed in one visit and used in subsequent visits, are also stored in the cache. As a result, second and further visits get a subtree containing only all necessary earlier computed values (the bindings) as a parameter. The algorithm runs in O(|Affected| + |paths_to_roots|) steps after modifying subtrees, where paths_to_roots is the sum of the lengths of all paths from the root to all modified subtrees, which is almost as good as an optimal algorithm for first order AGs, which runs in O(|Affected|).
CITATION STYLE
Vogt, H., Swierstra, D., & Kuiper, M. (1991). Efficient incremental evaluation of higher order attribute grammars. In Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics) (Vol. 528 LNCS, pp. 231–242). Springer Verlag. https://doi.org/10.1007/3-540-54444-5_102
Mendeley helps you to discover research relevant for your work.