The abstraction and instantiation of string-matching programs

  • Authors:
  • Torben Amtoft;Charles Consel;Olivier Danvy;Karoline Malmkjær

  • Affiliations:
  • Department of Computing and Information Sciences, Kansas State University, 216 Nichols Hall, Manhattan, KS;INRIA/LaBRI/ENSEIRB, 1 avenue du docteur Albert Schweitzer, Domaine universitaire - BP 99, F-33402 Talence Cedex, France;BRICS, Department of Computer Science, University of Aarhus, Ny Munkegade, Building 540, DK-8000 Aarhus C, Denmark;Ericsson Telebit A/S, Skanderborgvej 232, DK-8260 Viby J., Denmark

  • Venue:
  • The essence of computation
  • Year:
  • 2002

Quantified Score

Hi-index 0.00

Visualization

Abstract

We consider a naive, quadratic string matcher testing whether a pattern occurs in a text; we equip it with a cache mediating its access to the text; and we abstract the traversal policy of the pattern, the cache, and the text. We then specialize this abstracted program with respect to a pattern, using the off-the-shelf partial evaluator Similix.Instantiating the abstracted program with a left-to-right traversal policy yields the linear-time behavior of Knuth, Morris and Pratt's string matcher. Instantiating it with a right-to-left policy yields the linear-time behavior of Boyer and Moore's string matcher.