We’re sorry, something doesn't seem to be working properly.

Please try refreshing the page. If that doesn't work, please contact support so we can address the problem.

Skip to main content
Log in

Demand-driven evaluation of collection attributes

  • Published:
Automated Software Engineering Aims and scope Submit manuscript

Abstract

In order to make attribute grammars useful for complicated analysis tasks, a number of extensions to the original Knuth formalism have been suggested. One such extension is the collection attribute mechanism, which allows the value of an attribute to be defined as a combination of contributions from distant nodes in the abstract syntax tree. Another extension that has proven useful is circular attributes, evaluated using fixed-point iteration. In this paper we show how collection attributes and the combined formalism, circular collection attributes, have been implemented in our declarative meta programming system JastAdd, and how they can be used for a variety of applications including devirtualization analysis, metrics and flow analysis. A number of evaluation algorithms are introduced and compared for applicability and efficiency. The key design criterion for our algorithms is that they work well with demand evaluation, i.e., defined properties are computed only if they are actually needed for a particular program. We show that the best algorithms work well on large practical problems including the analysis of large Java programs.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  • Bacon, D.F., Sweeney, P.F.: Fast static analysis of C++ virtual function calls. In: OOPSLA, pp. 324–341 (1996)

  • Beshers, G.M., Campbell, R.H.: Maintained and constructor attributes. In: Proceedings of the ACM SIGPLAN 85 Symposium on Language Issues in Programming Environments, pp. 34–42. ACM, New York (1985)

    Chapter  Google Scholar 

  • Blackburn, S.M., Garner, R., Hoffman, C., Khan, A.M., McKinley, K.S., Bentzur, R., Diwan, A., Feinberg, D., Frampton, D., Guyer, S.Z., Hirzel, M., Hosking, A., Jump, M., Lee, H., Moss, J.E.B., Phansalkar, A., Stefanović, D., VanDrunen, T., von Dincklage, D., Wiedermann, B.: The DaCapo benchmarks: Java benchmarking development and analysis. In: OOPSLA ’06: Proceedings of the 21st Annual ACM SIGPLAN Conference on Object-Oriented Programing, Systems, Languages, and Applications, New York, NY, USA, October 2006, pp. 169–190. ACM, New York (2006)

    Chapter  Google Scholar 

  • Boyland, J.T.: Descriptional composition of compiler components. PhD thesis, University of California, Berkeley (1996)

  • Boyland, J.T.: Remote attribute grammars. J. ACM 52(4), 627–687 (2005)

    Article  MathSciNet  Google Scholar 

  • Chidamber, S.R., Kemerer, C.F.: A metrics suite for object oriented design. IEEE Trans. Softw. Eng. 20(6), 476–493 (1994)

    Article  Google Scholar 

  • Detlefs, D., Agesen, O.: Inlining of virtual methods. In: ECOOP ’99: Proceedings of the 13th European Conference on Object-Oriented Programming, pp. 258–278. Springer, Berlin (1999)

    Google Scholar 

  • Ekman, T.: Extensible compiler construction. PhD thesis, Lund University, Sweden (2006)

  • Ekman, T., Hedin, G.: Rewritable reference attributed grammars. In: Proceedings of ECOOP 2004. LNCS, vol. 3086, pp. 144–169. Springer, Berlin (2004)

    Google Scholar 

  • Ekman, T., Hedin, G.: The JastAdd Extensible Java Compiler (2007). Accepted for publication at OOPSLA’07

  • Farrow, R.: Automatic generation of fixed-point-finding evaluators for circular, but well-defined, attribute grammars. In: Proceedings of CC’86, pp. 85–98. ACM, New York (1986)

    Google Scholar 

  • Hedin, G.: An overview of door attribute grammars. In: Proceedings of CC’94, Edinburgh. LNCS, vol. 786, pp. 31–51. Springer, Berlin (1994)

    Google Scholar 

  • Hedin, G.: Reference attributed grammars. Informatica (Slovenia) 24(3), 301–317 (2000)

    MATH  Google Scholar 

  • Hedin, G., Magnusson, E.: JastAdd: an aspect-oriented compiler construction system. Sci. Comput. Program. 47(1), 37–58 (2003)

    Article  MATH  MathSciNet  Google Scholar 

  • JastAdd: http://www.jastadd.org (2007)

  • Kaiser, G.E.: Semantics for structure editing environments. PhD thesis, Carnegie Mellon University (1985)

  • Kiczales, G., Hilsdale, E., Hugunin, J., Kersten, M., Palm, J., Griswold, W.G.: An overview of AspectJ. In: Proceedings of ECOOP 2001. LNCS, vol. 2072, pp. 327–355. Springer, Berlin (2001)

    Chapter  Google Scholar 

  • Knuth, D.E.: Semantics of context-free languages. Math. Syst. Theory 2(2), 127–145 (1968). Correction: Math. Syst. Theory 5(1), 95–96 (1971)

    Article  MATH  MathSciNet  Google Scholar 

  • Magnusson, E., Hedin, G.: Circular reference attributed grammars—their evaluation and applications. Sci. Comput. Program. 68(1), 21–37 (2007)

    Article  MATH  MathSciNet  Google Scholar 

  • Nilsson-Nyman, E., Ekman, T., Hedin, G., Magnusson, E.: Declarative intraprocedural flow analysis of Java source code. In: Proceedings of the 8th Workshop on Language Descriptions, Tools, and Applications (LDTA’08) at ETAPS 2008 (2008)

  • Poetzsch-Heffter, A.: Prototyping realistic programming languages based on formal specifications. Acta Inform. 34(10), 737–772 (1997)

    Article  MATH  MathSciNet  Google Scholar 

  • Spinellis, D.D.: ckjm—Chidamber and Kemerer Java Metrics. http://www.spinellis.gr/sw/ckjm/ (2007)

  • Sundaresan, V., Hendren, L., Razafimahefa, C., Vallée-Rai, R., Lam, P., Gagnon, E., Godin, C.: Practical virtual method call resolution for java. SIGPLAN Not. 35(10), 264–280 (2000)

    Article  Google Scholar 

  • Van Wyk, E., de Moor, O., Backhouse, K., Kwiatkowski, P.: Forwarding in attribute grammars for modular language design. In: Proceedings of CC 2002. LNCS, vol. 2304, pp. 128–142. Springer, Berlin (2002)

    Google Scholar 

  • Van Wyk, E., Bodin, D., Gao, J., Krishnan, L.: Silver: an extensible attribute grammar system. In: Proceedings of the 7th Workshop on Language Descriptions, Tools, and Applications (LDTA’07) at ETAPS 2007 (2007a)

  • Van Wyk, E., Krishnan, L., Schwerdfeger, A., Bodin, D.: Attribute grammar-based language extensions for Java. In: Proceedings of ECOOP’07. LNCS. Springer, Berlin (2007b)

    Google Scholar 

  • Vogt, H.H., Swierstra, S.D., Kuiper, M.F.: Higher order attribute grammars. In: Proceedings PLDI’89, pp. 131–145. ACM, New York (1989)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Eva Magnusson.

Additional information

This paper is an extended version of E. Magnusson, T. Ekman, and G. Hedin, “Extending Attribute Grammars with Collection Attributes—Evaluation and Applications”, In the proceedings of SCAM 2007, Seventh IEEE International Working Conference on Source Code Analysis and Manipulation.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Magnusson, E., Ekman, T. & Hedin, G. Demand-driven evaluation of collection attributes. Autom Softw Eng 16, 291–322 (2009). https://doi.org/10.1007/s10515-009-0046-z

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10515-009-0046-z

Keywords

Navigation