Cheney on the MTA (1994)
The article discusses a proposed method for implementing tail recursion in Scheme when compiling to C. It suggests using continuation-passing style to avoid stack overflow issues associated with traditional methods. The approach aims to simplify function calls and memory management by treating the C stack as a heap for dynamic allocation.
- ▪The proposed method converts Scheme into continuation-passing style before compiling to C functions.
- ▪This approach allows for normal C function calls while managing closures and user data structures efficiently.
- ▪The method aims to prevent stack overflow by using a garbage collection scheme that operates on the C stack.
Opening excerpt (first ~120 words) tap to expand
CONS Should Not CONS Its Arguments, Part II: Cheney on the M.T.A.[1] DRAFT for comp.lang.scheme.c Feb. 4, 1994 ACM Sigplan Notices 30, 9 (Sept. 1995), 17-20. Henry G. Baker Nimble Computer Corporation, 16231 Meadow Ridge Way, Encino, CA 91436 (818) 501-4956 (818) 986-1360 (FAX) Copyright (c) 1994 by Nimble Computer Corporation. All rights reserved. Abstract Previous Schemes for implementing full tail-recursion when compiling into C have required some form of "trampoline" to pop the stack. We propose solving the tail-recursion problem in the same manner as Standard ML of New Jersey, by allocating all frames in the (garbage-collected) heap. The Scheme program is translated into continuation-passing style, so the target C functions never return.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at Plover.