Abstract
Complex data dependencies can often be expressed concisely by defining a variable in terms of part of its own value. Such a circular reference can be naturally expressed in a lazy functional language or in an attribute grammar. In this paper, we consider circular references in the context of an imperative C-like language, by extending the language with a new construct, persistent variables. We show that an extension of partial evaluation can eliminate persistent variables, producing a staged C program. This approach has been implemented in the Tempo specializer for C programs, and has proven useful in the implementation of run-time specialization.
Article
This research was partially supported by the Danish Natural Science Research Council (PLT project).
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
A.W. Appel. Modern Compiler Implementation in ML. Cambridge University Press, 1998. pages 131–132, 138-139.
G.J. Barzdins and M.A. Bulyonkov. Mixed computation and translation: Linearisation and decomposition of compilers. Preprint 791 from Computing Centre of Sibirian division of USSR Academy of Sciences, p.32, Novosibirsk, 1988.
R.S. Bird. Using circular programs to eliminate multiple traversals of data. Acta Informatica, 21:239–250, 1984/85.
A. Bondorf and O. Danvy. Automatic autoprojection of recursive equations with global variables and abstract data types. Science of Computer Programming, 16:151–195, 1991.
S. Chirokoff, C. Consel, and R. Marlet. Combining program and data specialization. Higher-Order and Symbolic Computation, 12(4):309–335, December 1999.
C. Consel, L. Hornof, F. Noël, J. Noyé, and E.N. Volanschi. A uniform approach for compile-time and run-time specialization. In O. Danvy, R. Glück, and P. Thiemann, editors, Partial Evaluation, International Seminar, Dagstuhl Castle, number 1110 in Lecture Notes in Computer Science, pages 54–72, February 1996.
R. Glück and J. Jørgensen. An automatic program generator for multi-level specialization. Lisp and Symbolic Computation, 10:113–158, 1997.
L. Hornof and J. Noyé. Accurate binding-time analysis for imperative languages: Flow, context, and return sensitivity. Theoretical Computer Science, 248(1-2):3–27, 2000.
L. Hornof, J. Noyé, and C. Consel. Effective specialization of realistic programs via use sensitivity. In P. Van Hentenryck, editor, Proceedings of the Fourth International Symposium on Static Analysis, SAS’97, volume 1302 of Lecture Notes in Computer Science, pages 293–314, Paris, France, September 1997. Springer-Verlag.
T. Johnsson. Attribute grammars as a functional programming paradigm. In G. Kahn, editor, 1987 Conference on Functional Programming Languages and Computer Architecture, volume 274 of Lecture Notes in Computer Science, pages 154–173, Portland, OR, September 1987. Springer-Verlag.
N.D. Jones, C. Gomard, and P. Sestoft. Partial Evaluation and Automatic Program Generation. International Series in Computer Science. Prentice-Hall, June 1993.
J. Karczmarczuk. Calcul des adjoints et programmation paresseuse. In Journées Francophones des Langages Applicatifs (JFLA’ 2001), Metabief, France, January 2001.
U. Kastens. Ordered attributed grammars. Acta Informatica, 13:229–256, 1980.
T.B. Knoblock and E. Ruf. Data specialization. In Proceedings of the ACM SIGPLAN’ 96 Conference on Programming Language Design and Implementation, pages 215–225, Philadelphia, PA, May 1996. ACM SIGPLAN Notices, 31(5). Also TR MSR-TR-96-04, Microsoft Research, February 1996.
J. Lawall and G. Muller. Faster run-time specialized code using data specialization. Research Report 3833, INRIA, Rennes, France, December 1999.
K. Malmkjær. Program and data specialization: Principles, applications, and self-application. Master’s thesis, DIKU University of Copenhagen, August 1989.
R. Marlet, C. Consel, and P. Boinot. Efficient incremental run-time specialization for free. In Proceedings of the ACM SIGPLAN’ 99 Conference on Programming Language Design and Implementation (PLDI’99), pages 281–292, Atlanta, GA, May 1999.
M. Pennings. Generating incremental attribute evaluators. PhD thesis, Department of Computer Science, Utrecht University, The Netherlands, November 1994.
J. Saraiva. Purely Functional Implementation of Attribute Grammars. PhD thesis, Department of Computer Science, Utrecht University, The Netherlands, December 1999.
J. Saraiva, D. Swierstra, and M. Kuiper. Strictification of computations on trees. In 3th Latin-American Conference on Functional Programming (CLaPF’99), March 1999.
J. Saraiva, D. Swierstra, and M. Kuiper. Functional incremental attribute evaluation. In D.A. Watt, editor, 9th International Conference on Compiler Construction, volume 1781 of Lecture Notes in Computer Science, pages 279–294, Berlin, Germany, March 2000. Springer-Verlag.
J. Saraiva, D. Swierstra, M. Kuiper, and M. Pennings. Strictification of lazy functions. Technical Report UU-CS 1996-51, Utrecht University, 1996.
E. Sumii and N. Kobayashi. Online-and-offline partial evaluation: A mixed approach (extended abstract). In 2000 ACM SIGPLAN Workshop on Partial Evaluation and Semantics-Based Program Manipulation (PEPM’ 00), pages 12–21. ACM Press, 2000. Also available as SIGPLAN Notices 34(11).
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2001 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Lawall, J.L. (2001). Implementing Circularity Using Partial Evaluation. In: Danvy, O., Filinski, A. (eds) Programs as Data Objects. PADO 2001. Lecture Notes in Computer Science, vol 2053. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-44978-7_6
Download citation
DOI: https://doi.org/10.1007/3-540-44978-7_6
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-42068-2
Online ISBN: 978-3-540-44978-2
eBook Packages: Springer Book Archive