Skip to main content

Zipper-Based Attribute Grammars and Their Extensions

  • Conference paper
Programming Languages (SBLP 2013)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 8129))

Included in the following conference series:

Abstract

Attribute grammars are a suitable formalism to express complex software language analysis and manipulation algorithms, which rely on multiple traversals of the underlying syntax tree. Recently, Attribute Grammars have been extended with mechanisms such as references and high-order and circular attributes. Such extensions provide a powerful modular mechanism and allow the specification of complex fix-point computations. This paper defines an elegant and simple, zipper-based embedding of attribute grammars and their extensions as first class citizens. In this setting, language specifications are defined as a set of independent, off-the-shelf components that can easily be composed into a powerful, executable language processor. Several real examples of language specification and processing programs have been implemented in this setting.

This work is funded by ERDF - European Regional Development Fund through the COMPETE Programme (operational programme for competitiveness) and by National Funds through the FCT - Fundação para a Ciência e a Tecnologia (Portuguese Foundation for Science and Technology) within projects FCOMP-01-0124-FEDER-020532 and FCOMP-01-0124-FEDER-022701.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 54.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 73.00
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Knuth, D.: Semantics of Context-free Languages. Mathematical Systems Theory 2(2) (June 1968); Correction: Mathematical Systems Theory 5(1) (March 1971)

    Google Scholar 

  2. Dijkstra, A., Fokker, J., Swierstra, S.D.: The architecture of the utrecht haskell compiler. In: Weirich, S. (ed.) Haskell, pp. 93–104. ACM (2009)

    Google Scholar 

  3. Swierstra, D., Azero, P., Saraiva, J.: Designing and Implementing Combinator Languages. In: Swierstra, S.D., Oliveira, J.N. (eds.) AFP 1998. LNCS, vol. 1608, pp. 150–206. Springer, Heidelberg (1999)

    Chapter  Google Scholar 

  4. Fernandes, J.P., Saraiva, J.: Tools and Libraries to Model and Manipulate Circular Programs. In: Proceedings of the ACM SIGPLAN 2007 Symposium on Partial Evaluation and Program Manipulation, PEPM 2007, pp. 102–111. ACM Press (2007)

    Google Scholar 

  5. Middelkoop, A., Dijkstra, A., Swierstra, S.D.: Iterative type inference with attribute grammars. In: Visser, E., Järvi, J. (eds.) GPCE, pp. 43–52. ACM (2010)

    Google Scholar 

  6. Vogt, H.H., Swierstra, S.D., Kuiper, M.F.: Higher order attribute grammars. SIGPLAN Not. 24(7), 131–145 (1989)

    Article  Google Scholar 

  7. Saraiva, J., Swierstra, S.D.: Generating spreadsheet-like tools from strong attribute grammars. In: Pfenning, F., Macko, M. (eds.) GPCE 2003. LNCS, vol. 2830, pp. 307–323. Springer, Heidelberg (2003)

    Chapter  Google Scholar 

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

    Article  MathSciNet  MATH  Google Scholar 

  9. Van Wyk, E., Bodin, D., Gao, J., Krishnan, L.: Silver: an extensible attribute grammar system. Electron. Notes Theor. Comput. Sci. 203(2), 103–116 (2008)

    Article  Google Scholar 

  10. Ekman, T., Hedin, G.: The jastadd extensible java compiler. SIGPLAN Not. 42(10), 1–18 (2007)

    Article  Google Scholar 

  11. Sloane, A.M., Kats, L.C.L., Visser, E.: A pure object-oriented embedding of attribute grammars. Electron. Notes Theor. Comput. Sci. 253(7), 205–219 (2010)

    Article  Google Scholar 

  12. Huet, G.: The zipper. Journal of Functional Programming 7(5), 549–554 (1997)

    Article  MathSciNet  MATH  Google Scholar 

  13. Paakki, J.: Attribute grammar paradigms a high-level methodology in language implementation. ACM Comput. Surv. 27(2), 196–255 (1995)

    Article  Google Scholar 

  14. Adams, M.D.: Scrap your zippers: a generic zipper for heterogeneous types. In: Proceedings of the 6th ACM SIGPLAN Workshop on Generic Programming, WGP 2010, pp. 13–24. ACM, New York (2010)

    Google Scholar 

  15. Lämmel, R., Jones, S.P.: Scrap your boilerplate: a practical design pattern for generic programming. In: Procs. of the 2003 ACM SIGPLAN Inter. WorkShop on Types in Language Design and Implementation, TLDI 2003, pp. 26–37. ACM (2003)

    Google Scholar 

  16. Kuiper, M., Saraiva, J.: Lrc - A Generator for Incremental Language-Oriented Tools. In: Koskimies, K. (ed.) CC 1998. LNCS, vol. 1383, pp. 298–301. Springer, Heidelberg (1998)

    Chapter  Google Scholar 

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

    Article  MathSciNet  MATH  Google Scholar 

  18. Bird, R.: Using circular programs to eliminate multiple traversals of data. Acta Informatica 21, 239–250 (1984)

    Article  MATH  Google Scholar 

  19. Martins, P., Fernandes, J.P., Saraiva, J.: A purely functional combinator language for software quality assessment. In: Symposium on Languages, Applications and Technologies, SLATE 2012. OASICS, vol. 21, pp. 51–69. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik (2012)

    Google Scholar 

  20. Martins, P., Fernandes, J.P., Saraiva, J.: A web portal for the certification of open source software. In: 6th International Workshop on Foundations and Techniques for Open Source Software Certification, OPENCERT 2012. LNCS (2012) (to appear)

    Google Scholar 

  21. Martins, P., Carvalho, N., Fernandes, J.P., Almeida, J.J., Saraiva, J.: A framework for modular and customizable software analysis. In: Murgante, B., Misra, S., Carlini, M., Torre, C.M., Nguyen, H.-Q., Taniar, D., Apduhan, B.O., Gervasi, O. (eds.) ICCSA 2013, Part II. LNCS, vol. 7972, pp. 443–458. Springer, Heidelberg (2013)

    Chapter  Google Scholar 

  22. Uustalu, T., Vene, V.: Comonadic functional attribute evaluation. In: Trends in Functional Programming, vol. (10), pp. 145–162. Intellect Books (2005)

    Google Scholar 

  23. Badouel, E., Fotsing, B., Tchougong, R.: Yet another implementation of attribute evaluation. Research Report RR-6315, INRIA (2007)

    Google Scholar 

  24. Badouel, E., Fotsing, B., Tchougong, R.: Attribute grammars as recursion schemes over cyclic representations of zippers. Electronic Notes Theory Computer Science 229(5), 39–56 (2011)

    Article  MathSciNet  Google Scholar 

  25. Yakushev, A.R., Holdermans, S., Löh, A., Jeuring, J.: Generic programming with fixed points for mutually recursive datatypes. In: Procs. of the 14th ACM SIGPLAN International Conference on Functional Programming, pp. 233–244 (2009)

    Google Scholar 

  26. Johnsson, T.: Attribute grammars as a functional programming paradigm. In: Kahn, G. (ed.) Functional Programming Languages and Computer Architecture. LNCS, vol. 274, pp. 154–173. Springer, Heidelberg (1987)

    Chapter  Google Scholar 

  27. Kuiper, M., Swierstra, D.: Using attribute grammars to derive efficient functional programs. In: Computing Science in the Netherlands (November 1987)

    Google Scholar 

  28. de Moor, O., Backhouse, K., Swierstra, S.D.: First-class attribute grammars. Informatica (Slovenia) 24(3) (2000)

    Google Scholar 

  29. Viera, M., Swierstra, D., Swierstra, W.: Attribute Grammars Fly First-class: how to do Aspect Oriented Programming in Haskell. In: Procs. of the 14th ACM SIGPLAN Int. Conf. on Functional Programming, ICFP 2009, pp. 245–256 (2009)

    Google Scholar 

  30. Viera, M.: First Class Syntax, Semantics, and Their Composition. PhD thesis, Utrecht University, The Netherlands (2013)

    Google Scholar 

  31. Siek, J.: General purpose languages should be metalanguages. In: Procs. of ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation, pp. 3–4 (2010)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2013 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Martins, P., Fernandes, J.P., Saraiva, J. (2013). Zipper-Based Attribute Grammars and Their Extensions. In: Du Bois, A.R., Trinder, P. (eds) Programming Languages. SBLP 2013. Lecture Notes in Computer Science, vol 8129. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-40922-6_10

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-40922-6_10

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-40921-9

  • Online ISBN: 978-3-642-40922-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics