一种用于正则表达式的并行解析器
A parallel parser for regular expressions
AI总结:
本文提出一种面向多核平台的并行正则表达式解析器,将文本分块并行解析并压缩所有语法树到共享打包解析森林中,通过最小化推测开销的新技术实现随文本长度良好扩展的加速。
摘要:
正则表达式(RE)匹配是一种非常常见的功能,它扫描文本以查找由RE指定的模式的出现位置;它还包括更简单的RE识别功能。本文研究RE解析,它通过不仅提供模式在文本中的位置,还以树的形式提供每个模式出现的句法结构(该树表示RE运算符如何生成模式),从而涵盖了匹配功能。RE解析提高了匹配的选择性,同时避免了上下文无关文法解析器的复杂性。我们的解析器通过返回所有语法树的集合来处理有歧义的RE和文本,并将这些语法树压缩到Shared-Packed-Parse-Forest数据结构中。我们首先将RE转换为串行解析器,该解析器模拟有限自动机(FA),使得自动机经过的状态编码输入的语法树。在长文本上,串行匹配和解析对于时间受限的应用来说可能太慢。因此,我们提出了一种新颖高效的、面向多处理器计算平台的并行解析器;其相对于串行算法的加速比随文本长度良好扩展。我们创新性地将并行RE匹配器/识别器的典型方法应用于RE解析,在该方法中,文本被分割成多个块以并行解析,然后再连接在一起。这种方法受到所谓的推测开销的影响,因为块处理器缺乏关于前一个块结束时到达的状态的知识;这迫使每个块处理器在其所有状态中推测性地开始。我们引入了一种新技术来最小化推测开销。该多线程解析器程序用Java编写,已在一台商用多核计算机上使用公开的和合成的RE基准测试进行了验证和性能测量。报告了相对于串行解析的加速比、解析时间和解析器构建时间。
英文摘要:
Regular expression (RE) matching is a very common functionality that scans a text to find occurrences of patterns specified by an RE; it includes the simpler function of RE recognition. Here we address RE parsing, which subsumes matching by providing not just the pattern positions in the text, but also the syntactic structure of each pattern occurrence, in the form of a tree representing how the RE operators produced the patterns. RE parsing increases the selectivity of matching, yet avoiding the complications of context-free grammar parsers. Our parser manages ambiguous REs and texts by returning the set of all syntax trees, compressed into a Shared-Packed-Parse-Forest data-structure. We initially convert the RE into a serial parser, which simulates a finite automaton (FA) so that the states the automaton passes through encode the syntax tree of the input. On long texts, serial matching and parsing may be too slow for time-constrained applications. Therefore, we present a novel efficient parallel parser for multi-processor computing platforms; its speed-up over the serial algorithm scales well with the text length. We innovatively apply to RE parsing the approach typical of parallel RE matchers / recognizers, where the text is split into chunks to be parsed in parallel and then joined together. Such an approach suffers from the so-called speculation overhead, due to the lack of knowledge by a chunk processor about the state reached at the end of the preceding chunk; this forces each chunk processor to speculatively start in all its states. We introduce a novel technique that minimizes the speculation overhead. The multi-threaded parser program, written in Java, has been validated and its performance has been measured on a commodity multi-core computer, using public and synthetic RE benchmarks. The speed-up over serial parsing, parsing times, and parser construction times are reported.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。