Abstract
A CPS translation is a syntactic translation of programs, which is useful for describing their operational behavior. By iterating the standard call-by-value CPS translation, Danvy and Filinski discovered the CPS hierarchy and proposed a family of control operators, shift and reset, that make it possible to capture successive delimited continuations in a CPS hierarchy.
Although shift and reset have found their applications in several areas such as partial evaluation, most studies in the literature have been devoted to the base level of the hierarchy, namely, to level-1 shift and reset. In this article, we investigate the whole family of shift and reset. We give a simple calculus with level-n shift and level-n reset for an arbitrary n>0. We then give a set of equational axioms for them, and prove that these axioms are sound and complete with respect to the CPS translation. The resulting set of axioms is concise and a natural extension of those for level-1 shift and reset.
Similar content being viewed by others
References
Ariola, Z.M., Herbelin, H., Sabry, A.: A type-theoretic foundation of continuations and prompts. In: Proc. ACM SIGPLAN International Conference on Functional Programming, pp. 40–53 (2004)
Asai, K.: Online partial evaluation for shift and reset. In: Proc. ACM Workshop on Partial Evaluation and Semantics-Based Program Manipulation, pp. 19–30 (2002)
Asai, K.: Offline partial evaluation for shift and reset. In: Proc. 2004 ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation, pp. 3–14 (2004)
Berdine, J., O’Hearn, P., Reddy, U., Thielecke, H.: Linear continuation passing. Higher-Order Symb. Comput. 15(2–3), 181–208 (2002)
Biernacka, M., Biernacki, D., Danvy, O.: An operational foundation for delimited continuations. In: Proc. Fourth ACM SIGPLAN Workshop on Continuations, pp. 25–34. Technical Report CSR-04-1, School of Computer Science, University of Birmingham (2004)
Biernacki, D., Danvy, O.: On the dynamic extent of delimited continuations. Technical Report BRICS-RS-05-2, BRICS, University of Aarhus, Denmark (2005)
Danvy, O.: Type-directed partial evaluation. In: Proc. 23rd Symposium on Principles of Programming Languages, pp. 242–257 (1996)
Danvy, O., Filinski, A.: A functional abstraction of typed contexts. Technical Report 89/12, DIKU, University of Copenhagen (1989)
Danvy, O., Filinski, A.: Abstracting control. In: Proc. 1990 ACM Conference on Lisp and Functional Programming, pp. 151–160 (1990)
Danvy, O., Filinski, A.: Representing control: a study of the CPS transformation. Math. Struct. Comput. Sci. 2(4), 361–391 (1992)
Danvy, O., Yang, Z.: An operational investigation of the CPS hierarchy. In: Proc. 8th European Symposium on Programming, pp. 224–242 (1999)
Felleisen, M.: The theory and practice of first-class prompts. In: Proc. 15th Symposium on Principles of Programming Languages, pp. 180–190 (1988)
Filinski, A.: Representing monads. In: Proc. 21st Symposium on Principles of Programming Languages, pp. 446–457 (1994)
Filinski, A.: Controlling effects. Ph.D. Thesis, Carnegie Mellon University, available as Technical Report CMU-CS-96-119 (1996)
Filinski, A.: Representing layered monads. In: Proc. 26th Symposium on Principles of Programming Languages, pp. 175–188 (1999)
Flanagan, C., Sabry, A., Duba, B.F., Felleisen, M.: The essence of compiling with continuations. In: Proc. ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 237–247 (1993)
Friedman, H.: Classically and intuitionistically provably recursive functions. In: Lecture Notes in Mathematics, vol. 699, pp. 21–28 (1978)
Griffin, T.: A formulae-as-types notion of control. In: Proc. 17th Symposium on Principles of Programming Languages, pp. 47–58 (1990)
Gunter, C.A., Rémy, D., Riecke, J.G.: A generalization of exceptions and control in ML-like languages. In: Proc. Functional Programming and Computer Architecture, pp. 12–23 (1995)
Hieb, R., Dybvig, R., Anderson, C.W.: Subcontinuations. Lisp Symb. Comput. 6, 453–484 (1993)
Kameyama, Y.: A type-theoretic study on partial continuations. In: Proc. IFIP International Conference on Theoretical Computer Science, pp. 489–504 (2000)
Kameyama, Y.: Axiomatizing higher level delimited continuations. In: Proc. 3rd ACM SIGPLAN Workshop on Continuations, pp. 49–53. Technical Report 545, Computer Science Department, Indiana University (2004)
Kameyama, Y., Hasegawa, M.: A sound and complete axiomatization of delimited continuations. In: Proc. ACM SIGPLAN International Conference on Functional Programming, pp. 177–188 (2003)
Lawall, J., Danvy, O.: Continuation-based partial evaluation. In: Proc. 1994 ACM Conference on LISP and Functional Programming, pp. 227–238 (1994)
Moggi, E.: Computational lambda-calculus and monads. In: Proc. 4th Symposium on Logic in Computer Science, pp. 14–28 (1989)
Murthy, C.: Control operators, hierarchies, and pseudo-classical type systems: a-translation at work. In: Proc. First ACM Workshop on Continuations, pp. 49–72. Technical Report STAN-CS-92-1426, Stanford University (1992)
Plotkin, G.D.: Call-by-name, call-by-value, and the λ-calculus. Theor. Comput. Sci. 1, 125–159 (1975)
Sabry, A.: Note on axiomatizing the semantics of control operators. Technical Report CIS-TR-96-03, Dept. of Computer Science, University of Oregon (1996)
Sabry, A., Felleisen, M.: Reasoning about programs in continuation-passing style. Lisp Symb. Comput. 6(3–4), 289–360 (1993)
Sekiguchi, T., Sakamoto, T., Yonezawa, A.: Portable implementation of continuation operators in imperative languages by exception handling. In: Advances in Exception Handling Techniques, pp. 217–233 (2001)
Shan, C.: Shift to control. In: Proc. 5th Workshop on Scheme and Functional Programming, pp. 99–107 (2004)
Thielecke, H.: From control effects to typed continuation passing. In: Proc. 30th Symposium on Principles of Programming Languages, pp. 139–149 (2003)
Author information
Authors and Affiliations
Corresponding author
Additional information
This article is a revised version of the paper presented at 18th International Workshop on Computer Science Logic (CSL’04), September, 2004.
Rights and permissions
About this article
Cite this article
Kameyama, Y. Axioms for control operators in the CPS hierarchy. Higher-Order Symb Comput 20, 339–369 (2007). https://doi.org/10.1007/s10990-007-9009-x
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10990-007-9009-x