Type-based optimization for regular patterns

  • Authors:
  • Michael Y. Levin;Benjamin C. Pierce

  • Affiliations:
  • Microsoft Center for Software Excellence;University of Pennsylvania

  • Venue:
  • DBPL'05 Proceedings of the 10th international conference on Database Programming Languages
  • Year:
  • 2005

Quantified Score

Hi-index 0.00

Visualization

Abstract

Pattern matching mechanisms based on regular expressions feature in a number of recent languages for processing XML. The flexibility of these mechanisms demands novel approaches to the familiar problems of pattern-match compilation—how to minimize the number of tests performed during pattern matching while keeping the size of the output code small. We describe semantic compilation methods in which we use the schema of the value flowing into a pattern matching expression to generate efficient target code. We start by discussing a pragmatic algorithm used currently in the compiler of Xtatic and report some preliminary performance results. For a more fundamental analysis, we define an optimality criterion of “no useless tests” and show that it is not satisfied by Xtatic’s algorithm. We constructively demonstrate that the problem of generating optimal pattern matching code is decidable for finite (non-recursive) patterns.