Advertisement

Implementing Circularity Using Partial Evaluation

  • Julia L. Lawall
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2053)

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.

Keywords

Data Specialization Partial Evaluation Source Program Attribute Grammar Binding Time 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    A.W. Appel. Modern Compiler Implementation in ML. Cambridge University Press, 1998. pages 131–132, 138-139.Google Scholar
  2. 2.
    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.Google Scholar
  3. 3.
    R.S. Bird. Using circular programs to eliminate multiple traversals of data. Acta Informatica, 21:239–250, 1984/85.zbMATHCrossRefGoogle Scholar
  4. 4.
    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.zbMATHCrossRefGoogle Scholar
  5. 5.
    S. Chirokoff, C. Consel, and R. Marlet. Combining program and data specialization. Higher-Order and Symbolic Computation, 12(4):309–335, December 1999.zbMATHCrossRefGoogle Scholar
  6. 6.
    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.Google Scholar
  7. 7.
    R. Glück and J. Jørgensen. An automatic program generator for multi-level specialization. Lisp and Symbolic Computation, 10:113–158, 1997.CrossRefGoogle Scholar
  8. 8.
    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.zbMATHCrossRefGoogle Scholar
  9. 9.
    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.Google Scholar
  10. 10.
    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.Google Scholar
  11. 11.
    N.D. Jones, C. Gomard, and P. Sestoft. Partial Evaluation and Automatic Program Generation. International Series in Computer Science. Prentice-Hall, June 1993.zbMATHGoogle Scholar
  12. 12.
    J. Karczmarczuk. Calcul des adjoints et programmation paresseuse. In Journées Francophones des Langages Applicatifs (JFLA’ 2001), Metabief, France, January 2001.Google Scholar
  13. 13.
    U. Kastens. Ordered attributed grammars. Acta Informatica, 13:229–256, 1980.zbMATHCrossRefMathSciNetGoogle Scholar
  14. 14.
    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.Google Scholar
  15. 15.
    J. Lawall and G. Muller. Faster run-time specialized code using data specialization. Research Report 3833, INRIA, Rennes, France, December 1999.Google Scholar
  16. 16.
    K. Malmkjær. Program and data specialization: Principles, applications, and self-application. Master’s thesis, DIKU University of Copenhagen, August 1989.Google Scholar
  17. 17.
    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.Google Scholar
  18. 18.
    M. Pennings. Generating incremental attribute evaluators. PhD thesis, Department of Computer Science, Utrecht University, The Netherlands, November 1994.Google Scholar
  19. 19.
    J. Saraiva. Purely Functional Implementation of Attribute Grammars. PhD thesis, Department of Computer Science, Utrecht University, The Netherlands, December 1999.Google Scholar
  20. 20.
    J. Saraiva, D. Swierstra, and M. Kuiper. Strictification of computations on trees. In 3th Latin-American Conference on Functional Programming (CLaPF’99), March 1999.Google Scholar
  21. 21.
    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.CrossRefGoogle Scholar
  22. 22.
    J. Saraiva, D. Swierstra, M. Kuiper, and M. Pennings. Strictification of lazy functions. Technical Report UU-CS 1996-51, Utrecht University, 1996.Google Scholar
  23. 23.
    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).Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2001

Authors and Affiliations

  • Julia L. Lawall
    • 1
  1. 1.DIKU, University of CopenhagenCopenhagenDenmark

Personalised recommendations