Abstract
Attribute grammars (AGs) are a suitable formalism for the development of language processing systems. However, for languages including unrestricted labeled jumps, such as “goto” in C, the optimizers in compilers are difficult to write in AGs. This is due to two problems that few previous researchers could deal with simultaneously, i.e., references of attribute values on distant nodes and circularity in attribute dependency. This paper proposescircular remote attribute grammars (CRAGs), an extension of AGs that allows (1) direct relations between two distant attribute instances through pointers referring to other nodes in the derivation tree, and (2) circular dependencies, under certain conditions including those that arise from remote references. This extension gives AG programmers a natural means of describing language processors and programming environments for languages that include any type of jump structure. We also show a method of constructing an efficient evaluator for CRAGs called amostly static evaluator. The performance of the proposed evaluator has been measured and compared with dynamic and static evaluators.
Similar content being viewed by others
References
Aho, A. V., Sethi, R. and Ullman, J. D.,Compilers: Principles, Techniques, and Tools, Addison Wesley, 1986.
Babich, W. A. and Jazayeri, M., “The Method of Attributes for Data Flow Analysis Part I,”Acta Inf., 10, 3, pp. 245–264, 1978.
Babich, W. A. and Jazayeri, M., “The Method of Attributes for Data Flow Analysis Part II,”Acta Inf., 10, 3, pp. 265–272, 1978.
Boyland, J. T., “Conditional Attribute Grammars,”ACM Trans. Prog. Lang. Syst., 18, 1, pp. 73–108, 1996.
Boyland, J. T.,Descriptional Composition of Compiler Components, Ph.D. Thesis, University of California Berkeley, 1996.
Boyland, J. T., “Analyzing Direct Non-local Dependencies in Attribute Grammars,” inProc. of International Conference on Compiler Construction (CC’98) (Koskimies, K. ed.),1383, Lecture Notes in Computer Science, Springer-Verlag, pp. 31–49, 1998.
Farrow, R., “Automatic Generation of Fixed-Point-Finding Evaluator for Circular, but Well-Defined, Attribute Grammars,” inACM SIGPLAN ’86 Symposium on Compiler Construction, pp. 85–98, 1986.
Hedin, G., “Reference Attributed Grammars,” inProc. of Second Workshop on Attribute Grammars and their Applications (WAGA’99) (Parigot, D. and Mernik, M. eds.), INRIA rocquencourt, pp. 153–172, 1999.
Johnson, G. F. and Fischer, C. N., “A Meta-Language and System for Nonlocal Incremental Attribute Evaluation in Language-Based Editors,” inConference Record of the Twelfth Annual ACM Symposium on Principles of Programming Languages, pp. 141–151, 1985.
Jones, L. G., “Efficient Evaluation of Circular Attribute Grammars,”ACM Trans. Prog. Lang. Syst., 12, 3, pp. 429–462, 1990.
Kastens, U., Hutt, B. and Zimmermann, E.,GAG: A Practical Compiler Generator, 141, Lecture Notes in Computer Science, Springer-Verlag, 1982.
Katayama, T., “Translation of Attribute Grammars into Procedures,”ACM Trans. Prog. Lang. Syst., 6, 3, pp. 345–369, 1984.
Knuth, D. E., “Semantics of Context-Free Languages,”Math. Syst. Th., 2, 2, pp. 127–145, 1968. correction:5, 1, pp. 95–96, 1971.
Knuth, D. E., “An Empirical Study of FORTRAN Programs,”Software—Practice and Experience, 1, 2, pp. 105–133, 1971.
Rodeh, M. and Sagiv, M., “Finding Circular Attributes in Attribute Grammars,”Journal of the ACM, 46, 4, pp. 556–575, 1999.
Sasaki, A. and Sassa, M., “Circular Attribute Grammars with Remote Attribute References,” inProc. of 3rd Workshop on Attribute Grammars and their Applications (WAGA 2000) (Parigot, D. and Mernik, M. eds.), INRIA rocquencourt, pp. 125–140, 2000.
Tachikawa, S.,Implementation of Lazy Code Motion with Circular Remote Attribute Grammars, Bachelor’s thesis, Department of Information Science, Tokyo Institute of Technology (in Japanese), 2002.
Vorthmann, S. A., “Coordinated Incremental Attribute Evaluation on a DR-Threaded Tree,” inAttribute Grammars and their Applications. International Conference WAGA Proceedings (Deransart, P. and Jourdan, M., eds.),461, Lecture Notes in Computer Science, Springer-Verlag, pp. 207–221, 1990.
Author information
Authors and Affiliations
Additional information
Akira Sasaki: He is a research fellow of the Advanced Clinical Research Center in the Institute of Medical Science at the University of Tokyo. He received his BSc and MSc from Tokyo Institute of Technology, Japan, in 1994 and 1996, respectively. His research interests include programming languages, programming language processors and programming environments, especially compiler compilers, attribute grammars and systematic debugging. He is a member of the Japan Society for Software Science and Technology.
Masataka Sassa, D.Sc.: He is Professor of Computer Science at Tokyo Institute of Technology. He received his BSc, MSc and DSc from the University of Tokyo, Japan, in 1970, 1972 and 1978, respectively. His research interests include programming languages, programming language processors and programming environments, currently he is focusing on compiler optimization, compiler infrastructure, attribute grammars and systematic debugging. He is a member of the ACM, IEEE Computer Society, Japan Society for Software Science and Technology, and Information Processing Society of Japan.
About this article
Cite this article
Sasaki, A., Sassa, M. Circular attribute grammars with remote attribute references and their evaluators. New Gener Comput 22, 37–60 (2004). https://doi.org/10.1007/BF03037280
Received:
Revised:
Issue Date:
DOI: https://doi.org/10.1007/BF03037280