-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Write a virtual machine for C++ regexes (#502)
The C++ standard library comes with a very slow engine for regular expressions in most implementations. For example, it seems that GNU C++ compiler runs in exponential time, see this bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93502 This is impractical for most real-world inputs. Therefore, we implement a virtual machine for matching regular expressions which runs in ``O(m * n)`` time (where ``m`` is the number of instructions in the regular expression and ``n`` is the length of the input). The original approach has been described in: Thompson, K., "Regular expression search algorithm", ACM 11(6) 1968 while we follow this blog post: https://swtch.com/~rsc/regexp/regexp2.html
- Loading branch information
Showing
73 changed files
with
75,798 additions
and
2,285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
"""Generate instructions for a virtual machine for matching regular expressions.""" | ||
|
||
from aas_core_codegen.cpp.pattern import _generate | ||
|
||
generate_header = _generate.generate_header | ||
generate_implementation = _generate.generate_implementation |
Oops, something went wrong.