Reflection-Based Parser for Legacy Code Semantic Trees

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Legacy software modernization is hindered by the complexity of parsing and analyzing millions of lines of code in languages like COBOL, RPG, and Fortran, where traditional grammars often become outdated and lead to synchronization issues between parsers and analysis tools, making it difficult to scale effectively.

Innovation Solution

The use of reflection programming techniques to represent the grammar of legacy languages in object-oriented classes, allowing for the creation of program semantic trees (PSTs) that capture both syntax and semantics, enabling scalable parsing and analysis by leveraging modern programming languages like Java or C#, which automatically detect changes and simplify tool writing.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If traditional grammars are used for parsing legacy code, then parsing can be performed with simple tools, but the grammars become outdated and lead to synchronization issues between parsers and analysis tools

Engineering Contradiction:
Improvesynchronization between parser and analysis toolsVSAvoidgrammar maintenance complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The parser automatically updates itself by re-parsing source code files to regenerate grammars and associated data structures. This self-service mechanism eliminates the need for manual grammar updates and ensures the parser remains synchronized with the latest code conventions without requiring external intervention or complex maintenance processes.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The grammar is transformed from a static, manually-maintained structure into a dynamic, automatically-regenerated component. The system continuously adapts by re-parsing source files to update grammars, ensuring the parser remains current with evolving codebases without requiring manual intervention.

Inventive Principle:
Principle #15Dynamics

2Productivity

If only a few people maintain the grammar and parser, then synchronization is maintained, but it becomes difficult to scale to millions of lines of code

Engineering Contradiction:
Improveparsing throughputVSAvoidmaintenance overhead
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The parser performs self-updates by automatically re-parsing source files to regenerate grammars and associated structures. This eliminates the need for manual maintenance by limited personnel and enables the system to scale to millions of lines of code without increasing maintenance overhead.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The system uses feedback from re-parsing source files to automatically update grammars and data structures. This closed-loop process ensures the parser adapts to changes in the codebase without external intervention, enabling scalable processing of large codebases.

Inventive Principle:
Principle #23Feedback

3Adaptability or versatility

If grammar changes are made to accommodate hardware and OS variations, then adaptability improves, but analysis tools get out of sync with the grammar

Engineering Contradiction:
Improvegrammar adaptabilityVSAvoidsynchronization between grammar and tools
Core Design Contradiction:
Adaptability or versatilityVSReliability

Solution Approach 1:

The grammar transitions from a static structure to a dynamic one that automatically adapts to hardware and OS variations. By continuously re-parsing source files, the system captures emerging conventions and updates grammars in real-time, maintaining both adaptability and synchronization without manual intervention.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The parser automatically detects and adapts to grammar changes through self-updating mechanisms. When hardware or OS variations introduce new coding patterns, the system re-parses affected files to regenerate grammars, ensuring tools remain synchronized without requiring manual updates.

Inventive Principle:
Principle #25Self-service

4Adaptability or versatility

If manual grammar updates are performed, then adaptability to new conventions is achieved, but time is lost and synchronization errors occur

Engineering Contradiction:
Improveconvention updatesVSAvoidgrammar maintenance time
Core Design Contradiction:
Adaptability or versatilityVSLoss of time

Solution Approach 1:

The parser automatically updates grammars by re-parsing source files, eliminating the need for manual intervention. This self-service approach captures new coding conventions immediately as they appear in the codebase, achieving full adaptability without consuming maintenance time.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The system performs preliminary updates by continuously re-parsing source files in the background, so grammars are already updated when needed. This prevents synchronization errors and eliminates manual update time by maintaining current grammars proactively rather than reactively.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS9710243B2Parser that uses a reflection technique to build a program semantic tree
Publication Date: 2017.07.18 EAGLE LEGACY MODEMIZATION
  • US9710243B2 patent drawing
  • US9710243B2 patent drawing
  • US9710243B2 patent drawing

AI summary

A grammar of a first programming language is represented in member fields and data types of object-oriented classes of a second programming language as an empty program semantic tree. A parser builds a new program semantic tree that represents source code written in the first programming language. The new program semantic tree is built by a reflection technique in which the member fields and data types of the object-oriented classes of the second programming language as set out in the empty program semantic tree are modified during the building of the new program semantic tree.