Skip to main content

Maximally-Polyvariant Partial Evaluation in Polynomial Time

  • Conference paper
  • First Online:
Perspectives of System Informatics (PSI 2015)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 9609))

Abstract

Maximally-polyvariant partial evaluation is a strategy for program specialization that propagates static values as accurate as possible. The online partial evaluator presented here achieves this precision in time polynomial in the number of partial-evaluation configurations. This is a significant improvement because a conventional partial evaluator can take exponential time, and no fast algorithm was known for maximally-polyvariant specialization. For an important class of quasi-deterministic specialization problems, our algorithm performs in linear time, even for linear-time specialization of a naive string matcher into a linear-time matcher, which was Futamura’s long-standing open challenge. Our results are presented using a recursive flowchart language.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    Multiple return variables; tests are evaluated in the assignment-updated store.

  2. 2.

    A return block that returns to itself halts a program: (spop (return (p) spop)).

References

  1. Ager, M.S., Danvy, O., Rohde, H.K.: Fast partial evaluation of pattern matching in strings. ACM TOPLAS 28(4), 696–714 (2006)

    Article  Google Scholar 

  2. Aho, A.V., Hopcroft, J.E., Ullman, J.D.: Time and tape complexity of pushdown automaton languages. Inf. Control 13(3), 186–206 (1968)

    Article  MATH  Google Scholar 

  3. Aho, A.V., Hopcroft, J.E., Ullman, J.D.: The Design and Analysis of Computer Algorithms. Addison-Wesley, Reading (1974)

    MATH  Google Scholar 

  4. Alur, R., Bouajjani, A., Esparza, J.: Model checking procedural programs. In: Clarke, E.M., Henzinger, T.A., Veith, H. (eds.) Handbook of Model Checking. Springer, Heidelberg (2016)

    Google Scholar 

  5. Amtoft-Hansen, T., Nikolajsen, T., Träff, J.L., Jones, N.D.: Experiments with implementations of two theoretical constructions. In: Meyer, A.R., Taitslin, M.A. (eds.) Logic at Botik 1989. LNCS, vol. 363, pp. 119–133. Springer, Heidelberg (1989)

    Chapter  Google Scholar 

  6. Bulyonkov, M.A.: Polyvariant mixed computation for analyzer programs. Acta Informatica 21(5), 473–484 (1984)

    Article  MathSciNet  MATH  Google Scholar 

  7. Bulyonkov, M.A.: Extracting polyvariant binding time analysis from polyvariant specializer. In: Partial Evaluation and Program Manipulation, pp. 59–65. ACM (1993)

    Google Scholar 

  8. Christensen, N.H., Glück, R.: Offline partial evaluation can be as accurate as online partial evaluation. ACM TOPLAS 26(1), 191–220 (2004)

    Article  Google Scholar 

  9. Consel, C., Danvy, O.: Partial evaluation of pattern matching in strings. Inf. Process. Lett. 30(2), 79–86 (1989)

    Article  Google Scholar 

  10. Cook, S.A.: Linear time simulation of deterministic two-way pushdown automata. In: Freiman, C.V., Griffith, J.E., Rosenfeld, J.L. (eds.) Information Processing 71, pp. 75–80. North-Holland, Amsterdam (1972)

    Google Scholar 

  11. Ershov, A.P.: On the partial computation principle. Inf. Process. Lett. 6(2), 38–41 (1977)

    Article  MATH  Google Scholar 

  12. Futamura, Y., Konishi, Z., Glück, R.: Automatic generation of efficient string matching algorithms by generalized partial computation. In: Asian Symposium on Partial Evaluation and Program Manipulation, pp. 1–8. ACM (2002)

    Google Scholar 

  13. Futamura, Y., Konishi, Z., Glück, R.: Program transformation system based on generalized partial computation. New Gener. Comput. 20(1), 75–99 (2002)

    Article  MATH  Google Scholar 

  14. Futamura, Y., Nogi, K.: Generalized partial computation. In: Bjørner, D., Ershov, A.P., Jones, N.D. (eds.) Partial Evaluation and Mixed Computation, North-Holland, pp. 133–151 (1988)

    Google Scholar 

  15. Glück, R.: A self-applicable online partial evaluator for recursive flowchart languages. Softw. Pract. Experience 42(6), 649–673 (2012)

    Article  Google Scholar 

  16. Glück, R.: A practical simulation result for two-way pushdown automata. In: Han, Y.-S., Salomaa, K. (eds.) Implementation and Application of Automata. LNCS, vol. 9705. Springer, Heidelberg (2016)

    Google Scholar 

  17. Glück, R., Jørgensen, J.: Generating transformers for deforestation and supercompilation. In: LeCharlier, B. (ed.) SAS 1994. LNCS, vol. 864, pp. 432–448. Springer, Heidelberg (1994)

    Chapter  Google Scholar 

  18. Glück, R., Klimov, A.V.: Occam’s razor in metacomputation: the notion of a perfect process tree. In: Cousot, P., Falaschi, M., Filé, G., Rauzy, A. (eds.) WSA 1993. LNCS, vol. 724, pp. 112–123. Springer, Heidelberg (1993)

    Chapter  Google Scholar 

  19. Gomard, C.K., Jones, N.D.: Compiler generation by partial evaluation: a case study. Structured Program. 12(3), 123–144 (1991)

    MathSciNet  Google Scholar 

  20. Grune, D., Jacobs, C.J.H.: Parsing Techniques: A Practical Guide. Monographs in Computer Science, 2nd edn. Springer, New York (2008)

    MATH  Google Scholar 

  21. Hatcliff, J.: An introduction to online and offline partial evaluation using a simple flowchart language. In: Hatcliff, J., Mogensen, T.Æ., Thiemann, P. (eds.) Partial Evaluation 1998. LNCS, vol. 1706, pp. 20–82. Springer, Heidelberg (1999)

    Chapter  Google Scholar 

  22. Jones, N.D.: A note on linear time simulation of deterministic two-way pushdown automata. Inf. Process. Lett. 6(4), 110–112 (1977)

    Article  MathSciNet  MATH  Google Scholar 

  23. Jones, N.D.: Automatic program specialization: a re-examination from basic principles. In: Bjørner, D., Ershov, A.P., Jones, N.D. (eds.) Partial Evaluation and Mixed Computation, North-Holland, pp. 225–282 (1988)

    Google Scholar 

  24. Jones, N.D., Gomard, C.K., Sestoft, P.: Partial Evaluation and Automatic Program Generation. Prentice-Hall, Englewood Cliffs (1993)

    MATH  Google Scholar 

  25. Knuth, D.E., Morris, J.H., Pratt, V.R.: Fast pattern matching in strings. SIAM J. Comput. 6(2), 323–350 (1977)

    Article  MathSciNet  MATH  Google Scholar 

  26. Mogensen, T.Æ.: Evolution of partial evaluators: removing inherited limits. In: Danvy, O., Glück, R., Thiemann, P. (eds.) Partial Evaluation. LNCS, vol. 1110, pp. 303–321. Springer, Heidelberg (1996)

    Chapter  Google Scholar 

  27. Rytter, W.: A simulation result for two-way pushdown automata. Inf. Process. Lett. 16(4), 199–202 (1983)

    Article  MathSciNet  MATH  Google Scholar 

  28. Sørensen, M.H., Glück, R., Jones, N.D.: A positive supercompiler. J. Funct. Program. 6(6), 811–838 (1996)

    Article  MATH  Google Scholar 

Download references

Acknowledgments

The author would like to thank Andrei Klimov and the anonymous reviewers for their comments, and Chung-chieh Shan for discussions of parsing. It is a great pleasure to thank Akihiko Takano for providing the author with excellent working conditions at the National Institute of Informatics, Tokyo, and Masami Hagiya and Zhenjiang Hu for their invaluable support.

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2016 Springer International Publishing Switzerland

About this paper

Cite this paper

Glück, R. (2016). Maximally-Polyvariant Partial Evaluation in Polynomial Time. In: Mazzara, M., Voronkov, A. (eds) Perspectives of System Informatics. PSI 2015. Lecture Notes in Computer Science(), vol 9609. Springer, Cham. https://doi.org/10.1007/978-3-319-41579-6_11

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-41579-6_11

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-41578-9

  • Online ISBN: 978-3-319-41579-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics