首页    期刊浏览 2025年06月14日 星期六
登录注册

文章基本信息

  • 标题:Fast Partial Evaluation of Pattern Matching in Strings
  • 本地全文:下载
  • 作者:Mads Sig Ager ; Olivier Danvy ; Henning Korsholm Rohde
  • 期刊名称:BRICS Report Series
  • 印刷版ISSN:0909-0878
  • 出版年度:2004
  • 卷号:11
  • 期号:40
  • 出版社:Aarhus University
  • 摘要:We show how to obtain all of Knuth, Morris, and Pratt's linear-time string matcher by specializing a quadratic-time string matcher with respect to a pattern string. Although it has been known for 15 years how to obtain this linear matcher by partial evaluation of a quadratic one, how to obtain it in linear time has remained an open problem. Obtaining a linear matcher by partial evaluation of a quadratic one is achieved by performing its backtracking at specialization time and memoizing its results. We show (1) how to rewrite the source matcher such that its static intermediate computations can be shared at specialization time and (2) how to extend the memoization capabilities of a partial evaluator to static functions. Such an extended partial evaluator, if its memoization is implemented efficiently, specializes the rewritten source matcher in linear time. Finally, we show that the method also applies to a variant of Boyer and Moore's string matcher. Supersedes BRICS-RS-03-11 and BRICS-RS-03-20.
国家哲学社会科学文献中心版权所有