|
ABSTRACT
Building program generators that do not duplicate generated code can be challenging. At the same time, code duplication can easily increase both generation time and runtime of generated programs by an exponential factor. We identify an instance of this problem that can arise when memoized functions are staged. Without addressing this problem, it would be impossible to effectively stage dynamic programming algorithms. Intuitively, direct staging undoes the effect of memoization. To solve this problem once and for all, and for any function that uses memoization, we propose a staged monadic combinator library. Experimental results confirm that the library works as expected. Preliminary results also indicate that the library is useful even when memoization is not used.
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
|
Umut A. A. Acar , Guy E. Blelloch , Robert Harper, Selective memoization, Proceedings of the 30th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, p.14-25, January 15-17, 2003, New Orleans, Louisiana, USA
|
 |
2
|
Mads Sig Ager , Olivier Danvy , Henning Korsholm Rohde, Fast partial evaluation of pattern matching in strings, Proceedings of the 2003 ACM SIGPLAN workshop on Partial evaluation and semantics-based program manipulation, p.3-9, June 07-07, 2003, San Diego, California, USA
|
| |
3
|
J. Aldrich. Open modules: A foundation for modular aspect-oriented programming. Available online from http://www-2.cs.cmu.edu/~aldrich/papers/tinyaspect.pdf, Jan. 2003.
|
 |
4
|
|
| |
5
|
|
| |
6
|
|
| |
7
|
C. Calcagno, E. Moggi, and W. Taha. ML-like inference for classifiers. In Proceedings of the European Symposium on Programming (ESOP '04), volume 2986 of Lecture Notes in Computer Science, Springer-Verlag, Mar. 2004.
|
| |
8
|
Cristiano Calcagno , Walid Taha , Liwen Huang , Xavier Leroy, Implementing multi-stage languages using ASTs, Gensym, and reflection, Proceedings of the second international conference on Generative programming and component engineering, p.57-76, September 22-25, 2003, Erfurt, Germany
|
| |
9
|
J. Carette and O. Kiselyov. Multi-stage programming with functors and monads: Eliminating abstraction overhead from generic code. In R. Glück and M. Lowry, editors, Proceedings of the ACM International Conference on Generative Programming and Component Engineering (GPCE'05), volume 3676 of Lecture Notes In Computer Science. Springer-Verlag, Sept. 2005.
|
| |
10
|
|
| |
11
|
|
 |
12
|
|
| |
13
|
W. DeMeuter. Monads as a theoretical foundation for AOP. In Proceedings of the International Workshop on Aspect-Oriented Programming at ECOOP, volume 1357 of Lecture Notes in Computer Science, page 25. Springer-Verlag, 1997.
|
| |
14
|
Dynamic Programming Benchmark. Available online from http://www.metaocaml.org/examples/dp, 2005.
|
 |
15
|
|
| |
16
|
J. Eckhardt, R. Kaiabachev, E. Pasalic, K. Swadi, and W. Taha. Implicitly heterogeneous multi-stage programming. In R. Glück and M. Lowry, editors, Proceedings of the ACM International Conference on Generative Programming and Component Engineering (GPCE'05), volume 3676 of Lecture Notes In Computer Science. Springer-Verlag, September 2005.
|
| |
17
|
|
| |
18
|
A. Filinski. Normalization by evaluation for the computational lambda-calculus. In S. Abramsky, editor, Proceedings of the International Conference on Typed Lambda Calculi and Applications (TLCA '01), volume 2044 of Lecture Notes in Computer Science, pages 151--165. Springer-Verlag, May 2001.
|
 |
19
|
Cormac Flanagan , Amr Sabry , Bruce F. Duba , Matthias Felleisen, The essence of compiling with continuations, Proceedings of the ACM SIGPLAN 1993 conference on Programming language design and implementation, p.237-247, June 21-25, 1993, Albuquerque, New Mexico, United States
|
 |
20
|
|
| |
21
|
|
| |
22
|
|
 |
23
|
|
| |
24
|
|
| |
25
|
|
 |
26
|
|
| |
27
|
O. Kiselyov and W. Taha. Relating FFTW and split radix. In Z. Wu, M. Guo, C. Chen, and J. Bu, editors, Proceedings of the International Conference on Embedded Software and Systems (ICESS '04), volume 3605 of Lecture Notes in Computer Science. Springer-Verlag, Dec. 2004.
|
| |
28
|
|
 |
29
|
|
 |
30
|
Sheng Liang , Paul Hudak , Mark Jones, Monad transformers and modular interpreters, Proceedings of the 22nd ACM SIGPLAN-SIGACT symposium on Principles of programming languages, p.333-343, January 23-25, 1995, San Francisco, California, United States
[doi> 10.1145/199448.199528]
|
 |
31
|
|
| |
32
|
|
| |
33
|
B. McAdam. Y in practical programs (extended abstract). Unpublished manuscript.
|
| |
34
|
|
| |
35
|
MetaOCaml: A compiled, type-safe multi-stage programming language. Available online from http://www.metaocaml.org/.
|
| |
36
|
|
| |
37
|
|
| |
38
|
E. Moggi and S. Fagorzi. A monadic multi-stage metalanguage. In A. Gordon, editor, Proceedings of Foundations of Software Science and Computation Structures (FOSSACS '03), volume 2620 of Lecture Notes in Computer Science. Springer-Verlag, Apr. 2003.
|
| |
39
|
|
| |
40
|
Oregon Graduate Institute Technical Reports. P.O. Box 91000, Portland, OR 97291-1000, USA. Available online from http://www.cse.ogi.edu/tech-reports/.
|
 |
41
|
Tim Sheard , Zine-el-abidine Benaissa , Emir Pasalic, DSL implementation using staging and monads, Proceedings of the 2nd conference on Domain-specific languages, p.81-94, October 03-06, 1999, Austin, Texas, United States
|
 |
42
|
|
| |
43
|
|
| |
44
|
|
 |
45
|
|
| |
46
|
|
 |
47
|
|
 |
48
|
|
| |
49
|
P. Thiemann. Continuation-based partial evaluation without continuations. In R. Cousot, editor, Proceedings of the International Symposium on Static Analysis (SAS '03), volume 2694 of Lecture Notes in Computer Science, pages 366--382. Springer-Verlag, 2003.
|
 |
50
|
|
| |
51
|
Daniel Weise , Roland Conybeare , Erik Ruf , Scott Seligman, Automatic online partial evaluation, Proceedings of the 5th ACM conference on Functional programming languages and computer architecture, p.165-191, June 1991, Cambridge, Massachusetts, United States
|
|