In-Memory Programming Language Translation via Token Stream

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

The inefficiency in translating computer programming languages using two separate compilers, where the output of the first compiler is written to disk and then read back by the second compiler, leads to redundant processes and resource utilization inefficiencies.

Innovation Solution

Implementing an in-memory language translation process where a transformation component generates a token stream from the parsed representation of the first compiler, bypassing optimization, code generation, and output writing phases, and eliminating input reading and lexical analysis phases of the second compiler, or passing the bit stream directly from the first compiler's code generator to the second compiler's lexical analyzer.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If two separate compilers are used to translate programming languages in two phases, then the translation can be accomplished with standard compiler tools, but the process requires disk access and file I/O operations which reduces efficiency

Engineering Contradiction:
Improvetranslation completenessVSAvoidtranslation efficiency
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent merges the output stage of the first compiler and the input stage of the second compiler into a single in-memory data structure (parse tree). Instead of writing to disk and reading back, the parse tree is directly passed between compilers, eliminating file I/O operations and improving translation efficiency while maintaining complete language translation functionality.

Inventive Principle:
Principle #5Merging (Combining)

Solution Approach 2:

The parse tree serves as an intermediary data structure that bridges the two compiler phases. Rather than using disk files as the intermediary, the patent uses an in-memory parse tree that can be directly generated by the first compiler's parser and consumed by the second compiler's parser, eliminating the need for disk access while ensuring complete translation.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Reliability

If the output of the first compiler is written to disk, then the data can be stored persistently, but the second compiler must read it back from disk which increases processing time and resource utilization

Engineering Contradiction:
Improvedata persistenceVSAvoidprocessing time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The patent replaces the mechanical disk I/O system with an in-memory data structure system. The parse tree is maintained in RAM throughout the compilation process, substituting physical disk read/write operations with faster memory access operations, thereby reducing processing time while ensuring data availability for both compiler phases.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

3Reliability

If the first compiler performs full optimization and code generation, then the output is complete, but the second compiler must re-parse the generated code which wastes computational resources

Engineering Contradiction:
Improvecode completenessVSAvoidcomputational resource utilization
Core Design Contradiction:
ReliabilityVSUse of energy by moving object

Solution Approach 1:

The patent extracts the essential semantic information from the first compiler's parse tree and passes it directly to the second compiler, bypassing the need for the second compiler to re-parse redundant code structures. This extraction of necessary information reduces computational resource utilization while ensuring the second compiler receives complete and accurate data for its optimization phase.

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

The first compiler performs preliminary parsing and creates a comprehensive parse tree that contains all necessary semantic information before the second compiler begins its work. This preliminary action ensures that the second compiler receives pre-processed, structured data that requires minimal re-parsing, thereby reducing overall computational resource utilization while maintaining code completeness.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS7823139B2Method and system for translating programming languages
Publication Date: 2010.10.26 ORACLE INT CORP
  • US7823139B2 patent drawing
  • US7823139B2 patent drawing
  • US7823139B2 patent drawing

AI summary

A system that provides programming language translation includes a first compiler that compiles a source file in a first programming language into a parsed representation of the first programming language, and a transformation component that receives the parsed representation and generates a token stream from the parsed representation. The token stream comprises second language tokens of a second programming language and at least one compilation phase of the first compiler is skipped. The system further includes a second compiler that compiles the token stream into an object code and skips at least one compilation phase of the second compiler. The transformation component provides the token stream to the second compiler in memory.