|
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. The C stack pointer then becomes the allocation pointer for a Cheney-style copying garbage collection scheme. Our Scheme can use C function calls, C arguments, C variable-arity functions, and separate compilation without requiring complex block-compilation of entire programs. Our C version of the "Boyer" benchmark is available at ftp://ftp.netcom.com/pub/hb/hbaker/cboyer13.c.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
| |
1
|
|
| |
2
|
|
| |
3
|
|
| |
4
|
Appel, A.W., and MacQueen, D.B. "Standard ML of New Jersey". In Wirsing, M., ed. Third Int'l Symp on Progr Lang Implementation and Logic Progr., Springer, August 1991.
|
 |
5
|
|
 |
6
|
|
| |
7
|
Bartlett, J. "Scheme¿C: A portable Scheme-to-C compiler". Tech. Rept., DEC West. Res. Lab., 1989.
|
 |
8
|
|
 |
9
|
|
 |
10
|
Will Clinger , Anne Hartheimer , Eric Ost, Implementation strategies for continuations, Proceedings of the 1988 ACM conference on LISP and functional programming, p.124-131, July 25-27, 1988, Snowbird, Utah, United States
[doi> 10.1145/62678.62692]
|
 |
11
|
|
| |
12
|
|
 |
13
|
|
| |
14
|
Friedman, D.P., and Wise, D.S. "CONS Should Not Evaluate Its Arguments". In Michaelson, S., and Milner, R., eds. Automata, Languages and Programming, Edinburgh U. Press, 1976, 257-284.
|
 |
15
|
|
| |
16
|
|
| |
17
|
|
| |
18
|
Stallman, R.M. "Phantom Stacks: If you look too hard, they aren't there". AI Memo 556, MIT AI Lab., July 1980.
|
| |
19
|
Stallman, R.M. Using and Porting GNU CC. Free Software Foundation, Inc. February, 1990.
|
| |
20
|
Steiner, J., and Hawkes, B. "The M.T.A." On the album The Kingston Trio At Large, released June 8, 1959, reached number 15 on June 15, 1959. Copyright Atlantic Music 1956-57.
|
 |
21
|
|
|