Higher-Order and Symbolic Computation

, Volume 18, Issue 1, pp 121–210

Derivation of Efficient Logic Programs by Specialization and Reduction of Nondeterminism

  • Alberto Pettorossi
  • Maurizio Proietti
  • Sophie Renault

DOI: 10.1007/s10990-005-7008-3

Cite this article as:
Pettorossi, A., Proietti, M. & Renault, S. Higher-Order Symb Comput (2005) 18: 121. doi:10.1007/s10990-005-7008-3


Program specialization is a program transformation methodology which improves program efficiency by exploiting the information about the input data which are available at compile time. We show that current techniques for program specialization based on partial evaluation do not perform well on nondeterministic logic programs. We then consider a set of transformation rules which extend the ones used for partial evaluation, and we propose a strategy for guiding the application of these extended rules so to derive very efficient specialized programs. The efficiency improvements which sometimes are exponential, are due to the reduction of nondeterminism and to the fact that the computations which are performed by the initial programs in different branches of the computation trees, are performed by the specialized programs within single branches. In order to reduce nondeterminism we also make use of mode information for guiding the unfolding process. To exemplify our technique, we show that we can automatically derive very efficient matching programs and parsers for regular languages. The derivations we have performed could not have been done by previously known partial evaluation techniques.


automatic program derivationprogram transformationprogram specializationlogic programmingtransformation rules and strategies

Copyright information

© Springer Science + Business Media, Inc. 2005

Authors and Affiliations

  • Alberto Pettorossi
    • 1
  • Maurizio Proietti
    • 2
  • Sophie Renault
    • 3
  1. 1.DISPUniversity of Roma Tor VergataRomaItaly
  2. 2.IASI-CNRRomaItaly
  3. 3.European Patent OfficeRijswijkThe Netherlands