Source Code Generation for Regular Expression Transparency
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Regular expressions are cryptic and opaque, making them difficult for developers to understand and debug, as their matching performance characteristics are not transparent, leading to unpredictable behavior in computer programs.
Innovation Solution
Automatically generating higher-level source code from regular expressions in the same programming language as the application project, allowing for integration, debugging, and optimization, eliminating the need for a regular expression engine and increasing transparency.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Extent of automation
If regular expressions are used for text matching, then text processing automation is achieved, but the matching process becomes opaque and difficult to understand
Solution Approach 1:
The patent creates a copy of the regular expression matching logic in the form of a syntax tree representation. This syntax tree is a simplified, human-readable copy that mirrors the structure and intent of the original regular expression without requiring the complex regex engine, making the matching logic transparent while preserving automation.
Solution Approach 2:
The patent introduces a syntax tree as an intermediary between the regular expression definition and the text matching process. This intermediary structure makes the matching logic visible and understandable while still enabling automated text processing, bridging the gap between automation and transparency.
2Adaptability or versatility
If regular expressions with metacharacter syntax are used, then text processing becomes concise and flexible, but the syntax becomes cryptic and hard to understand
Solution Approach 1:
The patent segments the regular expression into a syntax tree structure that breaks down the metacharacter syntax into discrete, understandable components. Each node in the syntax tree represents a specific element of the regex pattern, making the previously cryptic syntax visible and comprehensible while preserving the flexible matching capabilities.
3Extent of automation
If regular expression engines are used for matching, then pattern matching automation is achieved, but debugging and performance optimization become difficult
Solution Approach 1:
The patent creates a debuggable copy of the regex matching logic through the syntax tree representation. This copy can be inspected, modified, and debugged using standard programming techniques while maintaining the automated matching functionality, resolving the debugging difficulty.
4Productivity
If regular expressions are used, then succinct pattern specification is achieved, but matching performance characteristics become unpredictable
Solution Approach 1:
The patent creates a simplified copy of the matching logic in syntax tree form that eliminates the unpredictable performance characteristics of regex engines. The syntax tree uses straightforward, predictable algorithms for text matching while preserving the pattern specification efficiency of regular expressions.
Data Source
AI summary
The present application discloses methods, systems, and computer program products for automatically generating source code implementing a regular expression. A regular expression that is defined within source code of an application project is identified. The source code uses a higher-level programming language. Based on identifying the regular expression, a source code implementation of the regular expression is automatically generated using the higher-level programming language, and the source code implementation of the regular expression is integrated into the application project. After integrating the source code implementation of the regular expression into the application project, the source code implementation of the regular expression is compiled into lower-level code and the lower-level code is emitted into an application executable when building the application project, or the source code implementation of the regular expression is interpreted when executing the application project.


