ABSTRACT
It is possible to extend the basic notion of "function call" to allow functions to have multiple return points. This turns out to be a surprisingly useful mechanism. This paper conducts a fairly wide-ranging tour of such a feature: a formal semantics for a minimal λ -calculus capturing the mechanism; a motivating example; a static type system; useful transformations; implementation concerns and experience with an implementation; and comparison to related mechanisms, such as exceptions, sum-types and explicit continuations. We conclude that multiple-return function call is not only a useful and expressive mechanism, both at the source-code and intermediate-representation level, but is also quite inexpensive to implement.
- Andrew W. Appel. Modern Compiler Implementation in ML. Cambridge University Press, 1999. Google ScholarDigital Library
- Henk Barendregt. The Lambda Calculus. North Holland, revised edition, 1984.Google Scholar
- F. DeRemer and T. Pennello. Efficient Computation of LALR(1) Look-Ahead Set. TOPLAS, vol. 4,no. 4, October 1982. Google ScholarDigital Library
- C. Fisher and R. LeBlanc. Crafting a Compiler. Benjamin Cummings, 1988. Google ScholarDigital Library
- Andrzej Filinksi. Declarative Continuations and Categorical Duality. Master's thesis, Computer Science Department, University of Copenhagen (August 1989). DIKU Report 89/11.Google Scholar
- C. Flanagan, A. Sabry, B. Duba and M. Felleisen. The essence of compiling with continuations. Proceedings of the SIG-PLAN 1993 Conference on Programming Language Design and Implementation, 1993, 237--247. Google ScholarDigital Library
- American National Standard Programming Language FOR-TRAN. X3.9-1978, American National Standards Institute, Inc., April, 1978. Available at http://www.fortran.com/F77_std/rjcnf.htmlGoogle Scholar
- S. C. Johnson. Yacc-yet another compiler compiler. Tech report CSTR-32, AT&T Bell Laboratories, Murray Hill, NJ.Google Scholar
- David Kranz, et al. ORBIT: An optimizing compiler for Scheme. In Proceedings of the SIGPLAN '86 Symposium on Compiler Construction, published as SIGPLAN Notices 21(7), pages 219--233. Association for Computing Machinery, July 1986. Google ScholarDigital Library
- R. Milner. A theory of type polymorphism in programming. Journal of Computer and System Sciences, 17:348--375, August 1978.Google ScholarCross Ref
- R. Milner, M. Tofte, R. Harper, D. MacQueen. The Definition of Standard ML (Revised) MIT Press, 1997. Google ScholarDigital Library
- G. Morrisett, D. Tarditi, P. Cheng, C. Stone, R. Harper, and P. Lee. TIL: A type-directed optimizing compiler for ML. 1996 SIGPLAN Conference on Programming Language Design and Implementation, pages 181--192, Philadelphia, May 1996. Google ScholarDigital Library
- Thomas J. Pennello. Very fast LR parsing. In Proceedings of the SIGPLAN '86 Symposium on Compiler Construction, pages 145--151, 1986. Google ScholarDigital Library
- Norman Ramsey and Simon Peyton Jones. A single intermediate language that supports multiple implementations of exceptions. Proceedings of the ACM SIGPLAN 2000 Conference on Programming Language Design and Implementation, in SIGPLAN Notices, 35(5):285--298, June 2000. Google ScholarDigital Library
- Zhong Shao, John H. Reppy, and Andrew W. Appel. Unrolling Lists. In Proceedings of the 1994 ACM Conference on Lisp and Functional Programming, Orlando, Florida, pages 185--195, June 1994. Google ScholarDigital Library
- Olin Shivers. SRFI-32: Sort libraries. Scheme Request for Implementation 32, available at URL http://srfi.schemers.org/. Forthcoming.Google Scholar
- Guy L. Steele Jr. RABBIT: A Compiler for SCHEME. Technical Report 474, MIT AI Lab, May 1978. Google ScholarDigital Library
- Mitchell Wand. Complete type inference for simple objects, In Proceedings of the Second Symposium on Logic in Computer Science, Ithaca, New York, pages 37--44, June 1987.Google Scholar
Index Terms
- Multi-return function call
Recommendations
Multi-return function call
ICFP '04It is possible to extend the basic notion of "function call" to allow functions to have multiple return points. This turns out to be a surprisingly useful mechanism. This paper conducts a fairly wide-ranging tour of such a feature: a formal semantics for ...
Linear lambda calculus with non-linear first-class continuations
ICSCA '17: Proceedings of the 6th International Conference on Software and Computer ApplicationsThe Curry-Howard isomorphism is the correspondence between propositions and types, proofs and lambda-terms, and proof normalization and evaluation. In Curry-Howard isomorphism, we find a duality between values and continuations in pure functional ...
Term Sequent Logic
We consider a term sequent logic for the lambda-calculus. Term sequents are a judgement form similar to the logical judgement form of entailment between sentences, but denoting equality or reducibility between terms. Using term sequents, it is possible ...
Comments