Skip to main content

Efficient lazy narrowing using demandedness analysis

  • Conference paper
  • First Online:
Progamming Language Implementation and Logic Programming (PLILP 1993)

Abstract

Functional logic programming languages have a functional syntax and use narrowing as operational semantics. Here we consider the efficient implementation of lazy narrowing, a strategy which only evaluates the arguments of a function application, if their evaluation is really demanded. For an efficient implementation of lazy narrowing it is crucial to evaluate the arguments as early as possible. Otherwise the arguments are frequently reevaluated. A demandedness analysis is used to detect which parts of the arguments can safely be evaluated before the call to the function. Several approaches (e.g. [HLW92, JMM92]) also use this idea, but they sacrifice laziness in order to avoid inefficiency. Our approach is more lazy than the previous approaches, and it uses a more powerful notion of demandedness, which allows to express infinite demand patterns like e.g. spine normal form. Moreover, in contrast to the previous approaches, we take into account dependencies between the arguments of a function in order to improve the efficiency.

This work has been partially supported by the Spanish PRONTIC project TIC93-0737-C02-02

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

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. G.P. Balboni, P.G. Bosco, C. Cecchi, R. Melen, C. Moiso, G. Sofi: Implementation of a Parallel Logic Plus Functional Language, in: P. Treleaven (ed.), Parallel Computers: Object Oriented, Functional and Logic, Wiley, 1989.

    Google Scholar 

  2. P.G. Bosco, C. Cecchi, E. Giovannetti, C. Moiso, C. Palamidessi: Using Resolution for a Sound and Efficient Integration of Logic and Functional Progr., in: J. de Bakker (ed.), Languages for parallel architectures, Wiley, 1989.

    Google Scholar 

  3. G. Burn: Evaluation Transformers — A Model for the Parallel Evaluation of Functional Languages, FPCA'87, LNCS 274, 1987.

    Google Scholar 

  4. M. Bellia, G. Levi: The Relation between Logic and Functional Languages, Journal of Logic Programming, Vol.3, 1986, 217–236.

    Article  Google Scholar 

  5. A. Colmerauer, Prolog and Infinite Trees, Logic Programming, K.L. Clark, S.A. Tarnlund (eds), APIC Studies in Data Processing no. 16, Academic Press.

    Google Scholar 

  6. A. Colmerauer, Equations and Inequations on Finite and Infinite Trees, Proc. Int. Conf. on Fifth Generation Computer Systems, ICOT 1984, 85–99.

    Google Scholar 

  7. D.DeGroot, G.Lindstrom (eds.): Logic Programming: Functions, Relations, Equations, Prentice Hall, 1986.

    Google Scholar 

  8. M. Hanus: Compiling Logic Programs with Equality, Workshop on Progr. Language Impl. and Logic Progr. (PLILP), LNCS 456, 1990, 387–401.

    Google Scholar 

  9. W. Hans, R. Loogen, S. Winkler: On the Interaction of Lazy Evaluation and Backtracking, Procs. PLILP'92, LNCS 631, 1992, 355–369.

    Google Scholar 

  10. A. Herranz, J. Marino, J.J. Moreno-Navarro, Specialized Compilation of Lazy Functional Logic Programs, Techn. Report, UP Madrid.

    Google Scholar 

  11. G. Huet, Resolution d'équations dans les languages d'ordre 1, 2,...,ω, Thèse de doctorat d'etat, Université Paris VI.

    Google Scholar 

  12. G. Huet, D.C. Oppen, Equations and Rewrite Rules: A Survey, R.V. Book (ed.) Formal Language Theory: Perspectives..., Academic, 1980, 349–405.

    Google Scholar 

  13. J. Hughes: Why Functional Programming Matters, Technical Report 16, Programming Methodology Group, University of Göteborg, November 1984.

    Google Scholar 

  14. J.A. Jiménez-Martín, J. Mariño-Carballo, J.J. Moreno-Navarro: Some Techniques for the Efficient Compilation of Lazy Narrowing into Prolog, Procs. LOP-STR'92, Manchester, 1992.

    Google Scholar 

  15. H. Kuchen, R. Loogen, J.J. Moreno-Navarro, M. Rodríguez-Artalejo: Graph-based Implementation of a Functional Logic Language, Procs. ESOP'90, LNCS 432, 1990, 271–290.

    Google Scholar 

  16. R. Milner: A Theory of Type Polymorphism... JCSS 17(3), 1978, 348–375.

    Google Scholar 

  17. R. Loogen: From Reduction Machines to Narrowing Machines, TAPSOFT'91, LNCS 494, 1991, 438–457.

    Google Scholar 

  18. J.J. Moreno-Navarro, H. Kuchen, R. Loogen, M. Rodríguez-Artalejo: Lazy Narrowing in a Graph Machine, Procs. ALP'90, LNCS 463, 1990, 298–317.

    Google Scholar 

  19. J. Mariño-Carballo, J.J. Moreno-Navarro, Abstract Interpretation for Demandedness Analysis, Techn. Report, UP Madrid.

    Google Scholar 

  20. J.J.Moreno-Navarro, M. Rodrfguez-Artalejo: Logic Programming with Functions and Predicates: The Language Babel, J. Logic Prog., 12, 1992, 189–223,.

    Google Scholar 

  21. U.S. Reddy: Narrowing as the Operational Semantics of Functional Languages, Procs. Int. Symp. on Logic Programming, IEEE Comp. Soc. Press 1985, 138–151.

    Google Scholar 

  22. D.H.D. Warren: An Abstract Instruction Set, Techn. Note 309, SRI, 1983.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Maurice Bruynooghe Jaan Penjam

Rights and permissions

Reprints and permissions

Copyright information

© 1993 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Moreno-Navarro, J.J., Kuchen, H., Mariño-Carballo, J., Winkler, S., Hans, W. (1993). Efficient lazy narrowing using demandedness analysis. In: Bruynooghe, M., Penjam, J. (eds) Progamming Language Implementation and Logic Programming. PLILP 1993. Lecture Notes in Computer Science, vol 714. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-57186-8_78

Download citation

  • DOI: https://doi.org/10.1007/3-540-57186-8_78

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-57186-5

  • Online ISBN: 978-3-540-47945-1

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics