Summary
Attribute grammars are a value-oriented, non-procedural extension to context-free grammars that facilitate the specification of translations whose domain is described by the underlying context-free grammar. Just as parsers for context-free languages can be automatically constructed from a context-free grammar, so can translators, called attribute evaluators, be automatically generated from an attribute grammar. A major obstacle to generating efficient attribute evaluators is that they typically use large amounts of memory to represent the attributed parse tree. In this report we investigate the problem of efficient representation of the attributed parse tree by analyzing and comparing the strategies of two systems that have been used to automatically generate a translator from an attribute grammar: the GAG system developed at the Universitat de Karlsruhe and the LINGUIST-86 system written at Intel Corporation. Our analysis will characterize the two strategies and highlight their respective strengths and weaknesses. Drawing on the insights given by this analysis, we propose a strategy for storage optimization in automatically generated attribute evaluators that not only incorporates the best features of both GAG and LINGUIST-86, but also contains novel features that address aspects of the problem that are handled poorly by both systems.
Similar content being viewed by others
References
Asbrock, B., Kastens, U., Zimmermann, E.: Generating an Efficient Compiler Front-End. Technical Report 17/81, Universität Karlsruhe, Fakultät Für Informatik 1981
Farrow, R.: LINGUIST-86 Yet another translator writing system based on attribute grammars. Proceedings of the SIGPLAN 82 Symposium on Compiler Construction. ACM 1982
Farrow, R.: Experience with an attribute grammar based compiler. Conference Record of the Ninth ACM Symposium on Principles of Programming Languages. ACM 1982
Farrow, R.: Covers of Attribute Grammars and Sub-Protocol Attribute Evaluators. Technical Report, Department of Computer Science, Columbia University, New York 1983
Farrow, R.: Generating a Production Compiler from an Attribute Grammar. IEEE Software 1, 77–93 (1984)
Farrow, R., Yellin, D.M.: A Comparison of Storage Optimizations in Automatically-Generated Attribute Evaluators. Technical Report, Department of Computer Science, Columbia University, New York, 1985 (Extended version)
Ganzinger, H.: On storage optimization for automatically generated compilers. In: Theoretical Computer Science — Fourth GI Conference. (K. Weirauch ed.). Berlin, Heidelberg, New York: Springer 1979
Jazayeri, M., Walter, K.G.: Alternating semantic evaluator. Proc. ACM, pp. 230–234 (1975) (Annual Conference)
Jourdan, M.: Strongly Non-Circular Attribute Grammars and their Recursive Evaluation. Proceedings of the SIGPLAN'84 Symposium on Compiler Construction. SIGPLAN Not. 19, 81–93 (1984)
Kastens, U.: Ordered attribute grammars. Acta Inf. 13, 229–256 (1980)
Kastens, U., Hutt, B., Zimmermann, E.: GAG: A Practical Compiler Generator. Lect. Notes Comput. Sci. 141. Berlin, Heidelberg, New York: Springer 1982
Katayama, T.: Translation of Attribute Grammars into Procedures. ACM TOPLAS 6, (1984)
Kennedy, K., Warren, S.K.: Automatic generation of efficient evaluators for attribute grammars. Conference Record of the Third ACM Symposium on Principles of Programming Languages. ACM, 1976
Raiha, K.-J.: Dynamic allocation of space for attribute-instances in multi-pass evaluators of attribute grammars. Proceedings of the SIGPLAN 79 Symposium on Compiler Construction. ACM, 26–38 (1979)
Reps, T.W.: Generating Language-Based Environments. PhD thesis, Cornell University, Ithaca, New York 1983
Saarinen, M.: On constructing efficient evaluators for attribute grammars. In: Automata, Languages, and Programming: 5th Colloquium. (Ausiello and C. Bohm eds.). Berlin, Heidelberg, New York: Springer 1978
Schulz, W.A.: Semantic analysis and target language synthesis in a translator. PhD thesis, University of Colorado, Boulder, Colorada, 1976
Sethi, R.: Pebble Games For Studying Storage Sharing. Theoret. Comput. Sci. 19, 69–84 (1982)
Yellin, D.M.: A Survey of Tree-Walk Evaluation Strategies for Attribute Grammars. Technical Report, Department of Computer Science, Columbia University, New York, 1984
Author information
Authors and Affiliations
Additional information
This research was partially supported by the National Science Foundation under grant DCR-83-10930, and partially supported by the Defense Advanced Research Projects Agency under contract number N00039-84-C-0165
Rights and permissions
About this article
Cite this article
Farrow, R., Yellin, D. A comparison of storage optimizations in automatically-generated attribute evaluators. Acta Informatica 23, 393–427 (1986). https://doi.org/10.1007/BF00267865
Received:
Issue Date:
DOI: https://doi.org/10.1007/BF00267865