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
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
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.
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.
G. Burn: Evaluation Transformers — A Model for the Parallel Evaluation of Functional Languages, FPCA'87, LNCS 274, 1987.
M. Bellia, G. Levi: The Relation between Logic and Functional Languages, Journal of Logic Programming, Vol.3, 1986, 217–236.
A. Colmerauer, Prolog and Infinite Trees, Logic Programming, K.L. Clark, S.A. Tarnlund (eds), APIC Studies in Data Processing no. 16, Academic Press.
A. Colmerauer, Equations and Inequations on Finite and Infinite Trees, Proc. Int. Conf. on Fifth Generation Computer Systems, ICOT 1984, 85–99.
D.DeGroot, G.Lindstrom (eds.): Logic Programming: Functions, Relations, Equations, Prentice Hall, 1986.
M. Hanus: Compiling Logic Programs with Equality, Workshop on Progr. Language Impl. and Logic Progr. (PLILP), LNCS 456, 1990, 387–401.
W. Hans, R. Loogen, S. Winkler: On the Interaction of Lazy Evaluation and Backtracking, Procs. PLILP'92, LNCS 631, 1992, 355–369.
A. Herranz, J. Marino, J.J. Moreno-Navarro, Specialized Compilation of Lazy Functional Logic Programs, Techn. Report, UP Madrid.
G. Huet, Resolution d'équations dans les languages d'ordre 1, 2,...,ω, Thèse de doctorat d'etat, Université Paris VI.
G. Huet, D.C. Oppen, Equations and Rewrite Rules: A Survey, R.V. Book (ed.) Formal Language Theory: Perspectives..., Academic, 1980, 349–405.
J. Hughes: Why Functional Programming Matters, Technical Report 16, Programming Methodology Group, University of Göteborg, November 1984.
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.
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.
R. Milner: A Theory of Type Polymorphism... JCSS 17(3), 1978, 348–375.
R. Loogen: From Reduction Machines to Narrowing Machines, TAPSOFT'91, LNCS 494, 1991, 438–457.
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.
J. Mariño-Carballo, J.J. Moreno-Navarro, Abstract Interpretation for Demandedness Analysis, Techn. Report, UP Madrid.
J.J.Moreno-Navarro, M. Rodrfguez-Artalejo: Logic Programming with Functions and Predicates: The Language Babel, J. Logic Prog., 12, 1992, 189–223,.
U.S. Reddy: Narrowing as the Operational Semantics of Functional Languages, Procs. Int. Symp. on Logic Programming, IEEE Comp. Soc. Press 1985, 138–151.
D.H.D. Warren: An Abstract Instruction Set, Techn. Note 309, SRI, 1983.
Author information
Authors and Affiliations
Editor information
Rights 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