Higher-Order and Symbolic Computation

, Volume 26, Issue 1–4, pp 63–84 | Cite as

On graph rewriting, reduction, and evaluation in the presence of cycles

  • Ian Zerny


We inter-derive two prototypical styles of graph reduction: reduction machines à la Turner and graph rewriting systems à la Barendregt et al. To this end, we adapt Danvy et al.’s mechanical program derivations from the world of terms to the world of cyclic graphs. We also outline how to inter-derive a third style of graph reduction: a graph evaluator.


Graph reduction Term-graph rewriting Reduction machine  Defunctionalization Continuation-passing style  Refocusing 



Thanks are due to the anonymous HOSC reviewers and to Dennis Decker Jensen and the anonymous TFP’09 reviewers for their comments on earlier versions of this article. I am also grateful to Olivier Danvy for his supervision and for his course on functional programming at Aarhus University, where this work originates.


  1. 1.
    Ager, M.S., Biernacki, D., Danvy, O., Midtgaard, J.: A functional correspondence between evaluators and abstract machines. In: Miller, D. (ed.) Proceedings of the Fifth ACM-SIGPLAN International Conference on Principles and Practice of Declarative Programming (PPDP’03), pp. 8–19. ACM Press, Uppsala (2003)Google Scholar
  2. 2.
    Ariola, Z.M., Arvind, : Properties of a first-order functional language with sharing. Theor. Comput. Sci. 146(1&2), 69–108 (1995)MathSciNetCrossRefzbMATHGoogle Scholar
  3. 3.
    Barendregt, H.P.: Functional programming and lambda calculus. In: van Leeuwen, J. (ed.) Handbook of Theoretical Computer Science, Volume B: Formal Models and Semantics, vol. B, Chap. 7, pp. 321–364. Elsevier and The MIT Press, Cambridge (1990)Google Scholar
  4. 4.
    Barendregt, H.P., van Eekelen, M.C. J.D., Glauert, J.R.W., Kennaway, R., Plasmeijer, M.J., Sleep, M.R.: Term graph rewriting. In: de Bakker,J., Nijman, A.J. Treleaven, P.C. (eds) PARLE, Parallel Architectures and Languages Europe, Vol. II: Parallel Languages, Number 259 in Lecture Notes in Computer Science. Springer, Eindhoven, The Netherlands, pp. 141–158 (1987)Google Scholar
  5. 5.
    Biernacka, M., Danvy, O.: A concrete framework for environment machines. ACM Trans. Comput. Logic 9(1), 1–30 (2007)MathSciNetCrossRefzbMATHGoogle Scholar
  6. 6.
    Biernacka, M., Danvy, O.: Towards compatible and interderivable semantic specifications for the Scheme programming language, Part II: Reduction semantics and abstract machines. In Palsberg [35], pages 186–206.Google Scholar
  7. 7.
    Bülck, T., Held, A., Kluge, W.E., Pantke, S., Rathsack, C., Scholz, S.-B., Schröder, R.: Experience with the implementation of a concurrent graph reduction system on an nCUBE/2 platform. In: Buchberger, B., Volkert, J. (eds.) Parallel Processing: CONPAR 94—VAPP VI, Number 854 in Lecture Notes in Computer Science, pp. 497–508. Springer, Berlin (1994)Google Scholar
  8. 8.
    Burn, G., Peyton Jones, S.L., Robson, J.D.: The spineless G-machine. In R.Cartwright, editor, Proceedings of the 1988 ACM Conference on Lisp and Functional Programming pp. 244–258. ACM Press, Snowbird (1988)Google Scholar
  9. 9.
    Burton, F.W.: A linear space translation of functional programs to Turner combinators. Inf. Process. Lett. 14(5), 201–204 (1982)MathSciNetCrossRefzbMATHGoogle Scholar
  10. 10.
    Curry, H.B., Hindley, J.R., Feys, R.: Combinatory Logic: Volume II. North Holland, Amsterdam (1972)Google Scholar
  11. 11.
    Danvy, O.: Defunctionalized interpreters for programming languages. In P. Thiemann, (ed.) Proceedings of the 2008 ACM SIGPLAN International Conference on Functional Programming (ICFP’08), SIGPLAN Notices, Victoria, BC, ACM Press. Invited talk, 43(9),131–142 (2008)Google Scholar
  12. 12.
    Danvy, O.: From reduction-based to reduction-free normalization. In: Koopman, P., Plasmeijer, R., Swierstra, D. (eds.) Advanced Functional Programming, Sixth International School, Number 5382 in Lecture Notes in Computer Science, pp. 66–164. Springer, Nijmegen (2008)Google Scholar
  13. 13.
    Danvy, O.: Towards compatible and interderivable semantic specifications for the Scheme programming language, Part I: Denotational Semantics, Natural Semantics, and Abstract Machines. In Palsberg [35], pp. 162–185Google Scholar
  14. 14.
    Danvy, O., Johannsen, J.: Inter-deriving semantic artifacts for object-oriented programming. J. Comput. Syst. Sci. 76, 302–323 (2010)MathSciNetCrossRefzbMATHGoogle Scholar
  15. 15.
    Danvy, O., Johannsen, J., Zerny, I.: A walk in the semantic park. In: Khoo, S.-C., Siek, J. (eds.) Proceedings of the 2011 ACM SIGPLAN Workshop on Partial Evaluation and Semantics-Based Program Manipulation (PEPM 2011). ACM Press, Austin. Invited talk, 1–12 Jan (2011)Google Scholar
  16. 16.
    Danvy, O., Millikin, K.: On the equivalence between small-step and big-step abstract machines: a simple application of lightweight fusion. Inf. Process. Lett. 106(3), 100–109 (2008)MathSciNetCrossRefzbMATHGoogle Scholar
  17. 17.
    Danvy, O., Millikin, K.: A rational deconstruction of Landin’s SECD machine with the J operator. Log. Methods Comput. Sci. 4(4:12), 1–67 (2008)MathSciNetzbMATHGoogle Scholar
  18. 18.
    Danvy, O., Millikin, K.: Refunctionalization at work Science of Computer Programming. Extended Version Available as the Research Report BRICS RS-08-04. 74(8), 534–549 (2009)Google Scholar
  19. 19.
    Danvy, O., Millikin, K., Munk, J., Zerny, I.: On inter-deriving small-step and big-step semantics: a case study for storeless call-by-need evaluation. Theor. Comput. Sci. 435, 21–42 (2012)MathSciNetCrossRefzbMATHGoogle Scholar
  20. 20.
    Danvy, O., Nielsen, L.R.: Defunctionalization at work. In H. Søndergaard (ed.) Proceedings of the Third International ACM SIGPLAN Conference on Principles and Practice of Declarative Programming (PPDP’01). ACM Press, Firenze. Extended version available as the research report BRICS RS-01-23, pp. 162–174 (2001)Google Scholar
  21. 21.
    Danvy, O., Nielsen, L.R.: Refocusing in reduction semantics. Research Report BRICS RS-04-26, Department of Computer Science, Aarhus University, Aarhus, Denmark, A Preliminary Version Appeared in the Informal Proceedings of the Second International Workshop on Rule-Based Programming (RULE 2001), Electronic Notes in Theoretical Computer Science, vol. 59.4 (2004)Google Scholar
  22. 22.
    Danvy, O., Zerny, I.: Three syntactic theories for combinatory graph reduction. In: Alpuente, M. (ed.) Logic Based Program Synthesis and Transformation, 20th International Symposium, LOPSTR 2010, Revised Selected Papers, Number 6564 in Lecture Notes in Computer Science, pp. 1–20. Invited talk, Springer, Hagenberg (2010)Google Scholar
  23. 23.
    Felleisen, M., Findler, R.B., Flatt, M.: Semantics Engineering with PLT Redex. The MIT Press, Cambridge (2009)zbMATHGoogle Scholar
  24. 24.
    Glauert, J.R.W., Kennaway, R., Sleep, M.R.: Dactl: An experimental graph rewriting language. In: Ehrig, H., Kreowski, H.-J., Rozenberg, G. (eds.) Graph-Grammars and their Application to Computer Science, 4th International Workshop, Proceedings, Number 532 in Lecture Notes in Computer Science, pp. 378–395. Springer, Bremen (1990)Google Scholar
  25. 25.
    Huet, G.: The zipper. J. Funct. Progr. 7(5), 549–554 (1997)MathSciNetCrossRefzbMATHGoogle Scholar
  26. 26.
    Hughes, J.: Super combinators: a new implementation method for applicative languages. In: Friedman, D.P., Wise, D.S. (ed.) Conference Record of the 1982 ACM Symposium on Lisp and Functional Programming, pp. 1–10. ACM Press, Pittsburgh (1982)Google Scholar
  27. 27.
    Hutton, G., Wright, J.: Calculating an Exceptional Machine. In H.-W. Loidl, (ed.) Trends in Functional Programming, vol. 5. Intellect (2006)Google Scholar
  28. 28.
    Jeffrey, A.: A fully abstract semantics for concurrent graph reduction. In Proceedings of the Ninth Annual IEEE Symposium on Logic in Computer Science, pp. 82–91. IEEE Computer Society Press, Los Alamitos (1994)Google Scholar
  29. 29.
    Johnsson, T.: Efficient compilation of lazy evaluation. In: Graham, S.L. (ed.) Proceedings of the 1984 Symposium on Compiler Construction, SIGPLAN Notices, vol. 19, no. 6, pp. 58–69. ACM Press, Montréal, Canada (1984)Google Scholar
  30. 30.
    Koopman, P.W.M.: Functional Programs as Executable Specifications. PhD thesis, University of Nijmegen (1990)Google Scholar
  31. 31.
    Landin, P.J.: The mechanical evaluation of expressions. Comput. J 6(4), 308–320 (1964)CrossRefzbMATHGoogle Scholar
  32. 32.
    Loidl, H.-W., Rubio, F., Scaife, N., Hammond, K., Horiguchi, S., Klusik, U., Loogen, R., Michaelson, G., Pena, R., Priebe, S., Portillo, Á.J.R., Trinder, P.W.: Comparing parallel functional languages: programming and performance. High. Order Symbol. Comput. 16(3), 203–251 (2003)CrossRefzbMATHGoogle Scholar
  33. 33.
    Milner, R., Tofte, M., Harper, R., MacQueen, D.: The Definition of Standard ML (Revised). The MIT Press, Cambridge (1997)Google Scholar
  34. 34.
    Ohori, A., Sasano, I.: Lightweight fusion by fixed point promotion. In: Felleisen, M. (ed.) Proceedings of the Thirty-Fourth Annual ACM Symposium on Principles of Programming Languages, SIGPLAN Notices, vol. 42, No. 1, pp. 143–154. ACM Press, Nice (2007)Google Scholar
  35. 35.
    Palsberg, J., (ed.) Semantics and Algebraic Specification: Essays dedicated to Peter D. Mosses on the occasion of his 60th birthday, number 5700 in Lecture Notes in Computer Science. Springer, Berlin (2009)Google Scholar
  36. 36.
    Jones, S.L.P.: The Implementation of Functional Programming Languages. Prentice Hall International Series in Computer Science. Prentice-Hall International, London (1987)Google Scholar
  37. 37.
    Jones, S.L.P.: Implementing lazy functional languages on stock hardware: the spineless tagless G-machine. J. Funct. Progr. 2(2), 127–202 (1992)CrossRefzbMATHGoogle Scholar
  38. 38.
    Pirog, M., Biernacki, D.: A systematic derivation of the STG machine verified in Coq. In: Gibbons, J. (ed.) Haskell ’10: Proceedings of the 2010 ACM SIGPLAN Haskell Symposium, pp. 25–36. ACM Press, Baltimore (2010)Google Scholar
  39. 39.
    Plasmeijer, M.J., van Eekelen, M.C.J.D.: Functional Programming and Parallel Graph Rewriting. Addison-Wesley, Reading (1993)zbMATHGoogle Scholar
  40. 40.
    Plotkin, G.D.: Call-by-name, call-by-value and the \(\lambda \)-calculus. Theor. Comput. Sci. 1, 125–159 (1975)MathSciNetCrossRefzbMATHGoogle Scholar
  41. 41.
    Turner, D.A.: A new implementation technique for applicative languages. Softw. Pract. Exp. 9(1), 31–49 (1979)CrossRefzbMATHGoogle Scholar
  42. 42.
    van Eekelen, M., Smetsers, S., Plasmeijer, R.: Graph rewriting semantics for functional programming languages. In: Proceedings of the Fifth Annual Conference of the European Association for Computer Science Logic, pp. 106–128. Springer, Berlin (1996)Google Scholar
  43. 43.
    Wadsworth, C.P.: Semantics and Pragmatics of the Lambda Calculus. PhD thesis, Programming Research Group, Oxford University (1971)Google Scholar
  44. 44.
    Zerny, I.: On graph rewriting, reduction and evaluation. In: Horváth, Z., Zsók, V., Achten, P., Koopman, P. (eds.) Trends in Functional Programming, vol. 10, pp. 81–112, Komárno, Slovakia, Intellect Books. Best student-paper award of TFP 2009 (2009)Google Scholar

Copyright information

© Springer Science+Business Media New York 2015

Authors and Affiliations

  1. 1.Department of Computer ScienceAarhus UniversityAarhusDenmark
  2. 2.Google AarhusAarhusDenmark

Personalised recommendations