Finite State Machine Code Translation
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Translating code between computing platforms is challenging due to differences in memory, run-time, and power usage, and often results in software-related security vulnerabilities like memory leaks and buffer overflows.
Innovation Solution
The method involves generating a deterministic finite state machine (DFSM) from the source code, optimizing it to minimize states, and then converting it back to code in a different language, using techniques like reversing the DFSM to NFSM and applying optimization algorithms to reduce states and eliminate security vulnerabilities.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If code is translated from one computing platform to another, then code portability is improved, but security vulnerabilities increase
Solution Approach 1:
The patent introduces an intermediate representation (IR) as a mediator between the source code and target code. The IR serves as a formal, verified intermediate state that allows mathematical verification of security properties to be carried through the translation process, preventing vulnerabilities like memory leaks and buffer overflows from being introduced during platform translation.
Solution Approach 2:
The patent implements formal verification that provides feedback on security properties throughout the compilation process. By verifying that security-critical properties are preserved in the intermediate representation and maintained in the generated code, the system can detect and prevent security vulnerabilities before they manifest in the final translated code.
2Adaptability or versatility
If code is optimized for different computing platforms, then platform adaptability is improved, but code complexity increases
Solution Approach 1:
The patent segments the compilation process into distinct phases: parsing source code into an abstract syntax tree, converting to an intermediate representation with formal semantics, verifying security properties, and generating target code. This segmentation allows each phase to be independently optimized for different platforms without increasing overall code complexity, as the formal IR serves as a stable intermediary.
3Reliability
If formal verification is performed on the compiled code, then security reliability is improved, but compilation time increases
Solution Approach 1:
The patent performs formal verification of security properties on the intermediate representation before target code generation. By verifying security properties at this intermediate stage rather than after full compilation, the system catches security issues earlier in the process, reducing the need for iterative debugging and re-compilation, thereby actually reducing total compilation time while maintaining high security reliability.
Data Source
AI summary
Methods and systems for compiling codes from programming languages into programming languages are disclosed. An example method may include acquiring a first code written in a first language. The method allows generating, based on the first code, a first deterministic finite state machine (DFSM). The method includes optimizing the first DFSM to obtain a second DFSM. The method includes generating, based on the second DFSM, a second code. The second code can be written in a second language. Generating the first DFSM includes parsing the first code into a first abstract syntax tree (AST), translating the first AST into a first non-deterministic finite state machine (NFSM), and converting the first NFSM into the first DFSM. Generating the second code includes translating the second DFSM into a second NFSM, translating the second NFSM into a second AST, and recompiling the second AST into a second code.


