Source Code Generation for Regular Expression Transparency

Resolve Bottlenecks,
Find Innovative Solutions
Generate 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

VSEngineering 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

Engineering Contradiction:
Improvetext processing automationVSAvoidmatching process transparency
Core Design Contradiction:
Extent of automationVSLoss of information

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.

Inventive Principle:
Principle #26Copying

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.

Inventive Principle:
Principle #24Intermediary (Mediator)

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

Engineering Contradiction:
Improvetext processing flexibilityVSAvoiddeveloper understanding
Core Design Contradiction:
Adaptability or versatilityVSEase of operation

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.

Inventive Principle:
Principle #1Segmentation

3Extent of automation

If regular expression engines are used for matching, then pattern matching automation is achieved, but debugging and performance optimization become difficult

Engineering Contradiction:
Improvepattern matching automationVSAvoiddebugging capability
Core Design Contradiction:
Extent of automationVSEase of repair

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.

Inventive Principle:
Principle #26Copying

4Productivity

If regular expressions are used, then succinct pattern specification is achieved, but matching performance characteristics become unpredictable

Engineering Contradiction:
Improvepattern specification efficiencyVSAvoidmatching performance predictability
Core Design Contradiction:
ProductivityVSReliability

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.

Inventive Principle:
Principle #26Copying

Data Source

PatentUS11714609B2Automatic generation of source code implementing a regular expression
Publication Date: 2023.08.01 MICROSOFT TECHNOLOGY LICENSING LLC
  • US11714609B2 patent drawing
  • US11714609B2 patent drawing
  • US11714609B2 patent drawing

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.