<story><title>Hyperscan: A Fast Multi-Pattern Regex Matcher for Modern CPUs</title><url>https://branchfree.org/2019/02/28/paper-hyperscan-a-fast-multi-pattern-regex-matcher-for-modern-cpus/</url></story><parent_chain></parent_chain><comment><author>slaymaker1907</author><text>One of the most interesting ways to handle regex and general parsing IMO is by using derivitives. I&amp;#x27;m not sure if this uses any of the ideas from that area, but with derivitive based regex parsing instead of constructing some specific program to parse some language, you parse by instead transforming the original language to be the language of the union of the old language as well as the character just seen.&lt;p&gt;In addition to being incredibly simple to implement compared to traditional regex and parser generators, I think it is also interesting in that while it is really simple and looks like you are interpreting a language, it is actually powerful enough to parse arbitrary CFGs in O(n^3) with some help from memoization and fixpoints. See &lt;a href=&quot;http:&amp;#x2F;&amp;#x2F;matt.might.net&amp;#x2F;articles&amp;#x2F;parsing-with-derivatives&amp;#x2F;&quot; rel=&quot;nofollow&quot;&gt;http:&amp;#x2F;&amp;#x2F;matt.might.net&amp;#x2F;articles&amp;#x2F;parsing-with-derivatives&amp;#x2F;&lt;/a&gt; for more details.&lt;p&gt;I think the interesting aspect in terms of performance with something like this is that the derivitive based parsing system is explicitly streaming since it only stores the remaining input string and a regex string. Also, I think you can get around some of the performance issues with constructing these strings by replacing certain parts of the regex with more traditional NFAs&amp;#x2F;DFAs. In particular, I think this method provides an easy way to use simple equality matching for constant strings, DFAs for Kleene star, NFAs for the rest of the typical NFA features like the or operator and negation, then finally using the derivitive for very complicated features like capturing groups and backreferences.</text></comment>
<story><title>Hyperscan: A Fast Multi-Pattern Regex Matcher for Modern CPUs</title><url>https://branchfree.org/2019/02/28/paper-hyperscan-a-fast-multi-pattern-regex-matcher-for-modern-cpus/</url></story><parent_chain></parent_chain><comment><author>glangdale</author><text>Author here, in case anyone wants to question, abuse, argue, etc.</text></comment>