Abstract
Attribute Grammars are a powerfull, well-known formalism to implement and reason about programs which, by design, are conveniently modular.
In this work we focus on a state of the art Zipper-based embedding of Attribute Grammars and further improve its performance through controlling attribute (re)evaluation by using memoization techniques. We present the results of our optimization by comparing their impact in various implementations of different, well-studied Attribute Grammars.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
This binding can be seen in the definition of \( globmin \), in \(C_{ Root }\rightarrow locmin \;( tree \; t )\).
- 2.
- 3.
- 4.
This could also be represented in terms of a State monad, but we will not take that alternative in this paper.
References
Badouel, E., Fotsing, B., Tchougong, R.: Yet another implementation of attribute evaluation. Research Report RR-6315, Inria (2007)
Badouel, E., Fotsing, B., Tchougong, R.: Attribute grammars as recursion schemes over cyclic representations of zippers. Electron. Notes Theory Comput. Sci. 229(5), 39–56 (2011)
Balestrieri, F.: The productivity of polymorphic stream equations and the composition of circular traversals. PhD thesis, University of Nottingham (2015)
Bird, R.S.: Using circular programs to eliminate multiple traversals of data. Acta Inf. 21, 239–250 (1984)
de Moor, O., Backhouse, K., Swierstra, D.: First-class attribute grammars. In: 3rd Workshop on Attribute Grammars and their Applications, Ponte de Lima, Portugal, pp. 1–20 (2000)
Dijkstra, A., Fokker, J., Swierstra, S.D.: The architecture of the Utrecht Haskell compiler. In: Haskell Symposium, pp. 93–104 (2009)
Dijkstra, A., Swierstra, D.: Typing Haskell with an attribute grammar (part I). Technical report UU-CS-2004-037, Institute of Information and Computing Sciences, Utrecht University (2004)
Fernandes, J.P., Saraiva, J.: Tools and libraries to model and manipulate circular programs. In: Symposium on Partial Evaluation and Program Manipulation, pp. 102–111. ACM (2007)
Huet, G.: The zipper. J. Funct. Program. 7(5), 549–554 (1997)
Kastens, U., Pfahler, P., Jung, M.: The Eli system. In: Koskimies, K. (ed.) CC 1998. LNCS, vol. 1383, pp. 294–297. Springer, Heidelberg (1998)
Kiselyov, O., Lämmel, R., Schupke, K.: Strongly typed heterogeneous collections. In: Workshop on Haskell, pp. 96–107. ACM (2004)
Knuth, D.: Semantics of context-free languages. Math, Syst. Theory, 2(2) (1968). Correction: Math. Syst. Theory, 5(1) (1971)
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)
Magnusson, E., Hedin, G.: Circular reference attributed grammars - their evaluation and applications. Sci. Comput. Program. 68(1), 21–37 (2007)
Martins, P., Fernandes, J.P., Saraiva, J.: Zipper-based attribute grammars and their extensions. In: Du Bois, A.R., Trinder, P. (eds.) SBLP 2013. LNCS, vol. 8129, pp. 135–149. Springer, Heidelberg (2013)
Martins, P., Fernandes, J.P., Saraiva, J., Van Wyk, E., Sloane, A.: Embedding attribute grammars and their extensions using functional zippers. Science of Computer Programming (2016, in Press)
Middelkoop, A., Dijkstra, A., Swierstra, S.D.: Iterative type inference with attribute grammars. In International Conference on Generative Programming, pp. 43–52. ACM (2010)
Norell, U., Gerdes, A.: Attribute grammars in Erlang. In: Workshop on Erlang, 2015, pp. 1–12. ACM (2015)
Saraiva, J.: Purely functional implementation of attribute grammars. PhD thesis, Utrecht University, The Netherlands, December 1999
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)
Sloane, A.M., Kats, L.C.L., Visser, E.: A pure object-oriented embedding of attribute grammars. Electron. Notes Theory Comput. Sci. 253(7), 205–219 (2010)
Swierstra, D., Azero, P., Saraiva, J.: Designing and implementing combinator languages. In: Swierstra, S.D., Oliveira, J.N. (eds.) AFP 1998. LNCS, vol. 1608. Springer, Heidelberg (1999)
Uustalu, T., Vene, V.: Comonadic functional attribute evaluation. In: Trends in Functional Programming, vol. 10, pp. 145–162. Intellect Books (2005)
Van Wyk, E., Bodin, D., Gao, J., Krishnan, L.: Silver: an extensible attribute grammar system. Electron. Notes Theory Comput. Sci. 203(2), 103–116 (2008)
Viera, M., Swierstra, D., Swierstra, W.: First-class, attribute grammars fly: how to do aspect oriented programming in Haskell. In: International Conference on Functional Programming, pp. 245–256. ACM (2009)
Vogt, H., Swierstra, S.D., Kuiper, M.: Higher order attribute grammars. SIGPLAN Notices 24(7), 131–145 (1989)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2016 Springer International Publishing Switzerland
About this paper
Cite this paper
Fernandes, J.P., Martins, P., Pardo, A., Saraiva, J., Viera, M. (2016). Memoized Zipper-Based Attribute Grammars. In: Castor, F., Liu, Y. (eds) Programming Languages. SBLP 2016. Lecture Notes in Computer Science(), vol 9889. Springer, Cham. https://doi.org/10.1007/978-3-319-45279-1_4
Download citation
DOI: https://doi.org/10.1007/978-3-319-45279-1_4
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-45278-4
Online ISBN: 978-3-319-45279-1
eBook Packages: Computer ScienceComputer Science (R0)