Summary
The problem of deciding whether a given attribute grammar is noncircular is known to require exponential time for infinitely many grammars. Here the time requirement of a simple circularity test is analyzed. It is shown that the reason for the exponential time requirement is the number of graphs in a collection formed for every nonterminal. By practical experiments it is argued that for real grammars the number is very small. Therefore it is feasible to actually perform the circularity test in practice. Different techniques to improve the implementation of the circularity test are discussed, too.
Similar content being viewed by others
References
Aho, A.V., Ullman, J.D.: The Theory of parsing, translation, and compiling, Vol.2. Compiling. Englewood Cliffs, N.J.: Prentice-Hall 1973
Bruno, J., Burkhard, W.A.: A circularity test for interpreted grammars. Computer Science Laboratory, Department of Electrical Engineering, Princeton University, Technical Report 88, 1970
Engelfriet, J., Filè, G.: Passes and paths of attribute grammars. Information and Control 49, 125–169 (1981)
Jazayeri, M., Ogden, W.F., Rounds, W.C.: The intrinsically exponential complexity of the circularity problem for attribute grammars. Comm. ACM 18, 697–706 (1975)
Jones, N.D.: Circularity testing for attribute grammars requires exponential time: A simpler proof. Computer Science Department, Aarhus University, Report DAIMI PB-107, 1980
Karttunen, M.: On circularity tests for semantic attributes (in Finnish). Department of Computer Science, University of Helsinki, Report C-1977–87, 1977
Kennedy, K., Warren, S.K.: Automatic generation of efficient evaluators for attribute grammars. In: Conf. Record of the Third ACM Symposium on Principles of Programming Languages, pp. 32–49 (1976)
Knuth, D.E.: Semantics of context-free languages. Math. Systems Theory 2, 127–145 (1968)
Knuth, D.E.: Semantics of context-free languages: Correction. Math. Systems Theory 5, 95–96 (1971)
Koskimies, K., Juutinen, L.: An attribute grammar for the compile-time semantics of a subset of the programming language Euclid. Department of Computer Science, University of Helsinki, Report C-1979-130, 1979
Lorho, B., Pair, C.: Algorithms for checking consistency of attribute grammars. In: Proving and Improving Programs (G. Huet, G. Kahn, eds.), pp. 23–54. Le Chesnay: Colloques IRIA 1975
Räihä, K.-J.: Experiences with the compiler writing system HLP. In: Semantics-Directed Compiler Generation (N.D. Jones, ed.), pp. 350–362. Berlin-Heidelberg-New York: Springer 1980
Räihä, K.-J., Saarinen, M., Soisalon-Soininen, E., Tienari, M.: The compiler writing system HLP (Helsinki Language Processor). Department of Computer Science, University of Helsinki, Report A-1978-2, 1978
Author information
Authors and Affiliations
Rights and permissions
About this article
Cite this article
Räihä, K.J., Saarinen, M. Testing attribute grammars for circularity. Acta Informatica 17, 185–192 (1982). https://doi.org/10.1007/BF00288969
Received:
Issue Date:
DOI: https://doi.org/10.1007/BF00288969