VM: A Virtual Machine for Strict Evaluation of (Co)Recursive Functions

  • Baltasar Trancón y Widemann
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3474)


Corecursive definitions are usually only meaningful in functional languages with lazy evaluation semantics, because their domain and range may contain cyclic data graphs. By inspection of the call stack, it is possible in a strict evaluation environment to detect cycles in a computation, and thus transform finite input graphs infinite time. This paper presents a virtual machine with suitable cycle handling primitives and operational semantics to implement strict evaluation of corecursive functions. We discuss the impact on calling conventions and definition constructs, and demonstrate the relevance of the introduced features by application to the domain of infinite precision decimal arithmetics.


Virtual Machine Output Parameter Recursive Function Functional Language Cycle Detection 
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.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Abiteboul, S., van den Bussche, J.: Deep equality revisited. Deductive and Object-Oriented Databases (1995)Google Scholar
  2. 2.
    Aho, A.V., Sethi, R., Ullman, J.D.: Compilers: Principles, Techniques, and Tools. Addison-Wesley, Reading (1986)Google Scholar
  3. 3.
    Brownbridge, D.R.: Cyclic reference counting for combinator machines. In: Jouannaud, J.-P. (ed.) FPCA 1985. LNCS, vol. 201. Springer, Heidelberg (1985)Google Scholar
  4. 4.
    Common language infrastructure. Standard 23271, ISO/IEC (2003)Google Scholar
  5. 5.
    Cockett, R., Fukushima, T.: About Charity. Technical Report 92/480/18, University of Calgary (1992)Google Scholar
  6. 6.
    Fournet, C., Gordon, A.D.: Stack inspection: Theory and variants. ACM Trans. Program. Lang. Syst. 25(3), 360–399 (2003)CrossRefGoogle Scholar
  7. 7.
    Jones, R., Lins, R.: Garbage Collection. Wiley, Chichester (1996)zbMATHGoogle Scholar
  8. 8.
    Karczmarczuk, J.: The most unreliable technique in the world to compute π (1998),
  9. 9.
    Lindholm, T., Yellin, F.: The Java Virtual Machine Specification, 2nd edn. (1999)Google Scholar
  10. 10.
    Pavlovic, D., Pratt, V.: On coalgebra of real numbers. In: Jacobs, B., Rutten, J.J.M.M. (eds.) Coalgebraic Methods in Computer Science. Electronic Notes in Computer Science, vol. 19. Elsevier, Amsterdam (2000)Google Scholar
  11. 11.
    Pepels, E.J.H., van Eekelen, M.C.J.D., Plasmeijer, M.J.: A cyclic reference counting algorithm and its proof. Technical Report 88–10, Computing Science Department, University of Nijmegen (1988)Google Scholar
  12. 12.
    Peyton Jones, S.L.: Implementing lazy functional languages on stock hardware: The spineless tagless g-machine. Journal of Functional Programming 2(2), 127–202 (1992)zbMATHCrossRefGoogle Scholar
  13. 13.
    Salkild, J.D.: Implementation and analysis of two reference counting algorithms. Master’s thesis, University College, London (1987)Google Scholar
  14. 14.
    Telford, A., Turner, D.: Ensuring streams flow. In: Johnson, M. (ed.) AMAST 1997. LNCS, vol. 1349, pp. 509–523. Springer, Heidelberg (1997)CrossRefGoogle Scholar
  15. 15.
    Trancón y Widemann, B.: Stacking cycles: Functional transformation of circular data. In: Peña, R., Arts, T. (eds.) IFL 2002. LNCS, vol. 2670. Springer, Heidelberg (2003)Google Scholar
  16. 16.
    Trancón y Widemann, B.: Advanced strict corecursion. In: Draft Proceedings of the IFL 2003. Department of Computer Science, Heriot-Watt University, Edinburgh (2003)Google Scholar
  17. 17.
    Van Den Brand, M.G.J., Heering, J., Klint, P., Olivier, P.A.: Compiling language definitions: the asf+sdf compiler. ACM Trans. Program. Lang. Syst. 24(4), 334–368 (2002)CrossRefGoogle Scholar
  18. 18.
    Wikipedia: Recursion (2005),

Copyright information

© Springer-Verlag Berlin Heidelberg 2005

Authors and Affiliations

  • Baltasar Trancón y Widemann
    • 1
  1. 1.Fakultät für Elektrotechnik und InformatikTechnische Universität Berlin 

Personalised recommendations