Abstract
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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Abiteboul, S., van den Bussche, J.: Deep equality revisited. Deductive and Object-Oriented Databases (1995)
Aho, A.V., Sethi, R., Ullman, J.D.: Compilers: Principles, Techniques, and Tools. Addison-Wesley, Reading (1986)
Brownbridge, D.R.: Cyclic reference counting for combinator machines. In: Jouannaud, J.-P. (ed.) FPCA 1985. LNCS, vol. 201. Springer, Heidelberg (1985)
Common language infrastructure. Standard 23271, ISO/IEC (2003)
Cockett, R., Fukushima, T.: About Charity. Technical Report 92/480/18, University of Calgary (1992)
Fournet, C., Gordon, A.D.: Stack inspection: Theory and variants. ACM Trans. Program. Lang. Syst. 25(3), 360–399 (2003)
Jones, R., Lins, R.: Garbage Collection. Wiley, Chichester (1996)
Karczmarczuk, J.: The most unreliable technique in the world to compute π (1998), http://users.info.unicaen.fr/~karczma/arpap/lazypi.ps.gz
Lindholm, T., Yellin, F.: The Java Virtual Machine Specification, 2nd edn. (1999)
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)
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)
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)
Salkild, J.D.: Implementation and analysis of two reference counting algorithms. Master’s thesis, University College, London (1987)
Telford, A., Turner, D.: Ensuring streams flow. In: Johnson, M. (ed.) AMAST 1997. LNCS, vol. 1349, pp. 509–523. Springer, Heidelberg (1997)
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)
Trancón y Widemann, B.: Advanced strict corecursion. In: Draft Proceedings of the IFL 2003. Department of Computer Science, Heriot-Watt University, Edinburgh (2003)
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)
Wikipedia: Recursion (2005), http://en.wikipedia.org/wiki/Recursion
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2005 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Widemann, B.T.y. (2005). V→M: A Virtual Machine for Strict Evaluation of (Co)Recursive Functions. In: Grelck, C., Huch, F., Michaelson, G.J., Trinder, P. (eds) Implementation and Application of Functional Languages. IFL 2004. Lecture Notes in Computer Science, vol 3474. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11431664_6
Download citation
DOI: https://doi.org/10.1007/11431664_6
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-26094-3
Online ISBN: 978-3-540-32038-8
eBook Packages: Computer ScienceComputer Science (R0)