Advertisement

Profile-Based Abstraction and Analysis of Attribute Grammar Evaluation

  • Anthony M. Sloane
Conference paper
  • 762 Downloads
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7745)

Abstract

Attribute grammars enable complex algorithms to be defined on tree and graph structures by declarative equations. An understanding of how the equations cooperate is necessary to gain a proper understanding of an algorithm defined by an attribute grammar. Existing attribute grammar tools and libraries provide little assistance with understanding the behaviour of an attribute evaluator. To do better, we need a way to summarise behaviour in terms of attributes, their values, their relationships, and the structures that are being attributed. A simple approach to program profiling is presented that models program execution as a hierarchy of domain-specific profile records. An abstract event for attribute evaluation is defined and evaluators are modified to collect event instances at run-time and assemble the model. A flexible report writer summarises the event instances along both intrinsic and derived dimensions, including ones defined by the developer. Selecting appropriate dimensions produces reports that expose complex properties of evaluator behaviour in a convenient way. The approach is illustrated and evaluated using the profiler we have built for the Kiama language processing library. We show that the method is both useful and practical.

Keywords

Attribute Evaluation Attribute Equation Attribute Dimension Attribute Evaluator Attribute Grammar 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Bergel, A., Nierstrasz, O., Renggli, L., Ressia, J.: Domain-Specific Profiling. In: Bishop, J., Vallecillo, A. (eds.) TOOLS 2011. LNCS, vol. 6705, pp. 68–82. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  2. 2.
    Bouchou, B., Halfeld Ferrari, M., Lima, M.A.V.: Attribute Grammar for XML Integrity Constraint Validation. In: Hameurlain, A., Liddle, S.W., Schewe, K.-D., Zhou, X. (eds.) DEXA 2011, Part I. LNCS, vol. 6860, pp. 94–109. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  3. 3.
    Davidson, D., Smith, R., Doyle, N., Jha, S.: Protocol Normalization Using Attribute Grammars. In: Backes, M., Ning, P. (eds.) ESORICS 2009. LNCS, vol. 5789, pp. 216–231. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  4. 4.
    Ekman, T., Hedin, G.: The JastAdd extensible Java compiler. In: Proceedings of the ACM SIGPLAN Conference on Object-oriented Programming Systems and Applications, pp. 1–18. ACM, New York (2007)CrossRefGoogle Scholar
  5. 5.
    Fernandes, J.P., Saraiva, J., Seidel, D., Voigtländer, J.: Strictification of circular programs. In: Proceedings of the 20th ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation, PEPM 2011, pp. 131–140. ACM, New York (2011)Google Scholar
  6. 6.
    Graham, S.L., Kessler, P.B., Mckusick, M.K.: gprof: A call graph execution profiler. In: Proceedings of the 1982 SIGPLAN Symposium on Compiler Construction, SIGPLAN 1982, pp. 120–126. ACM, New York (1982)CrossRefGoogle Scholar
  7. 7.
    Han, F., Zhu, S.-C.: Bottom-up/top-down image parsing with attribute grammar. IEEE Transactions on Pattern Analysis and Machine Intelligence 31(1), 59–73 (2009)MathSciNetCrossRefGoogle Scholar
  8. 8.
    Hedin, G.: Reference Attributed Grammars. Informatica 24(3), 301–317 (2000)zbMATHGoogle Scholar
  9. 9.
    Hedin, G., Magnusson, E.: JastAdd: an aspect-oriented compiler construction system. Science of Computer Programming 47(1), 37–58 (2003)MathSciNetzbMATHCrossRefGoogle Scholar
  10. 10.
    Jourdan, M.: An Optimal-Time Recursive Evaluator for Attribute Grammars. In: Paul, M., Robinet, B. (eds.) Programming 1984. LNCS, vol. 167, pp. 167–178. Springer, Heidelberg (1984)CrossRefGoogle Scholar
  11. 11.
    Karim, M.R., Ryan, C.: A New Approach to Solving 0-1 Multiconstraint Knapsack Problems Using Attribute Grammar with Lookahead. In: Silva, S., Foster, J.A., Nicolau, M., Machado, P., Giacobini, M. (eds.) EuroGP 2011. LNCS, vol. 6621, pp. 250–261. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  12. 12.
    Kastens, U.: Ordered attribute grammars. Acta Informatica 13, 229–256 (1980)MathSciNetzbMATHCrossRefGoogle Scholar
  13. 13.
    Kastens, U., Waite, W.M.: Modularity and reusability in attribute grammars. Acta Informatica 31, 601–627 (1994)zbMATHCrossRefGoogle Scholar
  14. 14.
    Kats, L.C.L., Sloane, A.M., Visser, E.: Decorated Attribute Grammars: Attribute Evaluation Meets Strategic Programming. In: de Moor, O., Schwartzbach, M.I. (eds.) CC 2009. LNCS, vol. 5501, pp. 142–157. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  15. 15.
    Magnusson, E., Hedin, G.: Circular reference attributed grammars–their evaluation and applications. Science of Computer Programming 68(1), 21–37 (2007)MathSciNetzbMATHCrossRefGoogle Scholar
  16. 16.
    Mauro, J., Gregg, B., Mynhier, C.: DTrace: Dynamic Tracing in Oracle Solaris, Mac OS X and FreeBSD. Prentice Hall Professional (2011)Google Scholar
  17. 17.
    Nguyen, P., Falkner, K., Detmold, H., Munro, D.S.: A domain specific language for execution profiling & regulation. In: Proceedings of the Australasian Conference on Computer Science, pp. 123–132. Australian Computer Society, Inc. (2009)Google Scholar
  18. 18.
    Paakki, J.: Attribute grammar paradigms—a high-level methodology in language implementation. Computing Surveys 27(2), 196–255 (1995)CrossRefGoogle Scholar
  19. 19.
    Rajagopalan, M., Debray, S.K., Hiltunen, M.A., Schlichting, R.D.: Profile-directed optimization of event-based programs. In: Proceedings of the ACM SIGPLAN 2002 Conference on Programming Language Design and Implementation, PLDI 2002, pp. 106–116. ACM, New York (2002)CrossRefGoogle Scholar
  20. 20.
    Sansom, P.M., Peyton Jones, S.L.: Formally based profiling for higher-order functional languages. ACM Trans. Program. Lang. Syst. 19(2), 334–385 (1997)CrossRefGoogle Scholar
  21. 21.
    Saraiva, J.: Purely Functional Implementation of Attribute Grammars. PhD thesis, Department of Computer Science, Utrecht University, The Netherlands (December 1999)Google Scholar
  22. 22.
    Sloane, A.M.: Debugging Eli-Generated Compilers with Noosa. In: Jähnichen, S. (ed.) CC 1999. LNCS, vol. 1575, pp. 17–31. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  23. 23.
    Sloane, A.M.: Lightweight Language Processing in Kiama. In: Fernandes, J.M., Lämmel, R., Visser, J., Saraiva, J. (eds.) GTTSE 2009. LNCS, vol. 6491, pp. 408–425. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  24. 24.
    Sloane, A.M., Kats, L.C.L., Visser, E.: A pure embedding of attribute grammars. Science of Computer Programming (in press, 2012)Google Scholar
  25. 25.
    Söderberg, E., Hedin, G.: Automated Selective Caching for Reference Attribute Grammars. In: Malloy, B., Staab, S., van den Brand, M. (eds.) SLE 2010. LNCS, vol. 6563, pp. 2–21. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  26. 26.
    Van Wyk, E., Bodin, D., Gao, J., Krishnan, L.: Silver: An extensible attribute grammar system. Science of Computer Programming 75(1+2), 39–54 (2010)MathSciNetzbMATHGoogle Scholar
  27. 27.
    Vogt, H.H., Swierstra, S.D., Kuiper, M.F.: Higher order attribute grammars. In: PLDI 1989: Proceedings of the ACM SIGPLAN 1989 Conference on Programming Language Design and Implementation, pp. 131–145. ACM Press (1989)Google Scholar
  28. 28.
    Wirth, N.: Compiler Construction. Addison-Wesley (1996) (revised November 2005)Google Scholar
  29. 29.
    Yaghmour, K., Dagenais, M.: The Linux trace toolkit. Linux Journal (May 2000)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2013

Authors and Affiliations

  • Anthony M. Sloane
    • 1
  1. 1.Department of ComputingMacquarie UniversitySydneyAustralia

Personalised recommendations