Programming language conversion system in industrial mechanical arm and control method thereof
By providing an industrial robotic arm programming language conversion system, using multiple parsing and optimization modules to convert common code, the problem of incompatibility of robotic arm programming languages of different manufacturers is solved, the development cost and time is reduced, and the flexibility and scalability of the automation system is improved.
Patent Information
- Application Number
- CN202510190205.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-20
- Publication Date
- 2025-06-06
AI Technical Summary
In industrial automation, the programming of robotic arms usually depends on the programming language of a specific manufacturer. When it is necessary to replace the robotic arm manufacturer, existing program code often needs to be re-written, resulting in an increase in labor and time costs.
It provides a programming language conversion system and its control method in an industrial robot arm, including input program code module, symbol interpreter, algorithm analyzer, syntax parser, converter, semantic parser, peephole optimizer and arm-specific format code output module. Through these modules, the general programming language code is parsed, analyzed, optimized and converted, and special code suitable for target robot arm is generated.
It significantly reduces the development and time cost of industrial robotic arms in automation solutions, improves system flexibility and scalability, and enables code to be reused on different robotic arms platforms, thereby improving the efficiency and adaptability of industrial automation.
Smart Images

Figure CN120104137A_ABST
Abstract
Description
[0001] The present invention relates to the technical field of industrial robot arms, and in particular to a programming language conversion system in an industrial robot arm and a control method thereof. Background Art
[0002] The programming language conversion system in the industrial robot arm is a tool used to convert the general programming language code into the programming language dedicated to the specific robot arm manufacturer; The system parses, analyzes and optimizes the input general code through a series of modules (such as symbol interpreter, algorithm analyzer, syntax parser, converter, semantic parser and peephole optimizer), and finally generates special code suitable for the target robot arm. This system solves the problem of incompatibility of programming languages of robot arms from different manufacturers, significantly reduces development costs and time, improves the flexibility and scalability of the automation system, and enables the code to be reused on different robot arm platforms, thereby improving the efficiency and adaptability of industrial automation; In industrial automation, the programming of robotic arms usually depends on the programming language of a specific manufacturer. When the robotic arm manufacturer needs to be changed, the existing program code often needs to be rewritten, resulting in increased labor and time costs. Therefore, to address the above problems, a programming language conversion system and a control method for an industrial robotic arm are proposed. Summary of the invention
[0003] The purpose of the present invention is to provide a programming language conversion system and a control method for an industrial robot arm, so as to solve the problem that in industrial automation, the programming of the robot arm usually depends on the programming language of a specific manufacturer. When the robot arm manufacturer needs to be changed, the existing program code often needs to be rewritten, resulting in increased labor and time costs.
[0004] To achieve the above object, the present invention provides the following technical solutions: A programming language conversion system in an industrial robot arm and a control method thereof, comprising an input program code module, a symbol interpreter, an algorithm analyzer, a syntax parser, a converter, a semantic parser, a peephole optimizer and an arm-specific format code output module; The input program code module is used to receive a universal programming language code input by a user; The symbol interpreter uses a symbol recognition algorithm based on regular expressions to perform preliminary analysis on the input code and identify key symbols, variables, functions and operators in the code; The algorithm analyzer analyzes the logical dependencies in the code by constructing control flow graphs and data flow graphs, ensures the integrity of the algorithm logic, and optimizes loop structures and conditional branches; The syntax parser uses a top-down recursive descent parsing method to generate an intermediate representation that is independent of the target programming language, including a three-address code and a static single assignment format; The converter converts the intermediate representation into a dedicated programming language of the target robotic arm based on syntax matching, template replacement and rule mapping techniques, and supports a multi-vendor API adaptation mechanism; The semantic parser detects potential semantic errors in the converted code through static analysis and symbolic execution technology, and provides automatic correction suggestions; The peephole optimizer, based on the Peephole optimization strategy, performs instruction merging, arithmetic operation replacement and memory addressing optimization according to the CPU instruction set characteristics of the target robot arm to improve the code execution efficiency; The arm-specific program code output module supports JSON, XML, YAML and binary formats, and provides an interface for direct uploading to the robotic arm controller.
[0005] As a further optimization of the present invention, the symbol interpreter adopts a method based on regular expressions and abstract syntax tree analysis to efficiently identify variable scopes, namespaces and recursive call structures in the code, so as to achieve consistency in cross-language conversion.
[0006] As further optimized content of the present invention, the algorithm analyzer adopts static analysis technology, optimizes the code structure through control flow graph, performs loop expansion, dead code deletion, branch prediction and other optimizations to improve the execution efficiency of the converted code.
[0007] As further optimized content of the present invention, among others: the syntax parser adopts a multi-level parsing strategy, including lexical analysis, syntax analysis and semantic analysis, and generates an intermediate representation that can be adapted to different programming languages, supporting three-address code, static single assignment and other language-independent code formats.
[0008] As a further optimization of the present invention, the converter adopts a modular design and has a plug-in expansion mechanism, defines conversion rules through a domain-specific language, and combines the target robot arm API adaptation layer to achieve dynamic code conversion and optimization.
[0009] As a further optimization of the present invention, the semantic parser performs error detection on the conversion code based on rule matching and machine learning technology, including undefined variables, type mismatch, unreachable code, etc., and provides an automatic correction mechanism.
[0010] As further optimized content of the present invention, the peephole optimizer performs specific optimizations for different robotic arm CPU instruction sets, including instruction merging, loop unrolling and memory access optimization. The instruction merging is used to reduce repetitive operations, the loop unrolling is used to optimize loop iterations, and the memory access optimization is used to reduce unnecessary memory reads.
[0011] As a further optimization of the present invention, the arm-specific program code output module supports multiple output formats, including JSON, XML, YAML and binary files, and is compatible with control interface protocols of different robotic arms, including MODBUS and PROFINET.
[0012] As a further optimized content of the present invention, the following steps are included: S1: receiving a general programming language code input by a user; S2: Perform symbol recognition through symbol interpreter to extract code structure information; S3: Analyze control flow and data flow through the algorithm analyzer to extract the core computing logic; S4: Generate intermediate representation through syntax parser; S5: Perform language conversion based on syntax matching, template replacement and API adaptation through the converter; S6: Detect potential errors in the converted code through the semantic parser and automatically correct them; S7: Peephole optimization is performed through the peephole optimizer; S8: Output the final converted target robot arm code and adapt it to different interface protocols.
[0013] As a further optimization of the present invention, the converter adopts a dynamic adaptation mechanism during the conversion process, based on the hardware characteristics and programming language specifications of the target robotic arm, combined with a machine learning optimization strategy, to automatically adjust the code generation rules to improve the execution efficiency and compatibility of the code.
[0014] Compared with the prior art, the present invention has the following beneficial effects: In the present invention, by providing a universal programming language conversion system, the development cost and time cost of industrial robot arms in automation solutions are significantly reduced, the flexibility and scalability of the system are improved, and by introducing modules such as symbol interpreters, algorithm analyzers, syntax parsers, converters, semantic parsers and peephole optimizers, efficient and accurate code conversion and optimization are achieved, supporting programming languages of multiple robot arm manufacturers. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1A logic diagram of a programming language conversion system control in an industrial robot arm of the present invention; Figure 2 The present invention is a flowchart of a programming language conversion control method in an industrial robot arm. DETAILED DESCRIPTION
[0016] See also Figure 1-2 , the present invention provides a technical solution: A programming language conversion system and control method in an industrial robot arm, input program code module: The input program code module of the present invention is used to receive a universal programming language code input by a user. The user can submit the written control logic code to the module through a graphical interface or text input. The system supports a variety of common programming languages, such as C, C++, Python, etc. The module first formats the input code, checks whether the code meets the predetermined standards, and prompts the user to modify it if there is a problem with the input. The format of the input code can be a text file, JSON file or other structured data format; Symbol interpreter: After receiving the input code, the symbol interpreter performs preliminary analysis on the code. The symbol interpreter identifies key symbols, variables, functions, and operators in the code through regular expression and abstract syntax tree (AST) analysis. Its function is to extract the basic structural information of the code and provide a detailed symbol table for subsequent steps. This module can efficiently identify variable scopes, namespaces, recursive call structures, and other content in the code, ensuring consistency across language conversions and providing an accurate basis for subsequent algorithm analysis and syntax parsing; Algorithm Analyzer: The task of the algorithm analyzer is to analyze the algorithm logic in the input code and extract the core calculation process by constructing a control flow graph (CFG) and a data flow graph (DFG). In this step, the system converts the loop structure, branch structure and algorithm logic in the code into a graphical representation to ensure that all logical dependencies are clearly captured; This module analyzes each basic block, each conditional judgment, and each loop in the code, optimizes the loop structure, and deletes dead code to ensure that the converted code can be effectively executed without redundant parts; Syntax parser: The syntax parser uses a top-down recursive descent parsing method to parse the input code into an intermediate representation (IR). Through three steps of lexical analysis, syntax analysis, and semantic analysis, the system converts the input programming language code into an intermediate representation that is independent of the target programming language (such as three-address code (TAC), static single assignment (SSA), etc.); The intermediate representation (IR) will provide a language-independent standardized form for the subsequent conversion process, simplifying the conversion between languages and enabling the system to support multiple programming languages; Converter: The converter is one of the core modules of the present invention, responsible for converting the intermediate representation (IR) into the dedicated programming language of the target robot arm. In order to support programming languages of multiple manufacturers, the converter adopts the technology based on syntax matching, template replacement and rule mapping to realize language conversion. Through modular design, the converter can be expanded and support programming languages of different manufacturers through the plug-in mechanism; During the conversion process, the converter will also automatically adjust the code generation strategy according to the hardware characteristics and programming language specifications of the target robot arm to ensure that the generated code can be executed efficiently and conforms to the specifications of the target programming language; Semantic parser: The semantic parser is used to check the semantic correctness of the converted code to ensure that the converted code has no potential logical errors. The semantic parser uses static analysis and symbolic execution methods to detect errors in the converted code, including undefined variables, type mismatches, unreachable code, etc. If potential semantic errors are found during the detection process, the semantic parser will provide an automatic correction mechanism. Through rule matching and machine learning technology, the semantic parser can select the best solution from multiple conversion solutions and make necessary repairs to the code. Peephole Optimizer: The peephole optimizer performs local optimization on the converted code and performs customized optimization based on the CPU instruction set characteristics of the target robot. The optimizer implements the following optimization strategies: Instruction merging: Identify repeated operations and merge them into a single instruction to reduce the number of executions; Loop unrolling: For parts that are frequently looped, loop unrolling technology is used to reduce the number of loops and improve execution efficiency; Memory access optimization: Improve cache hit rate and reduce memory bottlenecks by optimizing memory access patterns, reducing cache invalidation, and merging memory accesses. The optimized code will be able to execute more efficiently, thus improving the performance of the entire system; Arm-specific program code output module: The arm-specific program code output module is responsible for outputting the converted and optimized code into a format suitable for a specific robotic arm. The supported output formats include text files, structured formats such as JSON, XML, YAML, and binary files; The module also supports uploading the code directly to the controller of the robot arm and deploying it through interface protocols (such as ROS API, MODBUS, PROFINET, etc.). Through flexible output methods, the system can be compatible with control systems of different manufacturers and facilitate users to perform subsequent debugging and optimization; The control method of the present invention comprises the following steps: Receive a general programming language code input by a user; The symbol interpreter performs symbol recognition on the code and extracts the basic structural information in the code; The algorithm analyzer analyzes the core computational logic in the code and captures the logical dependencies through the control flow graph (CFG) and data flow graph (DFG); The parser converts the code into an intermediate representation (IR), providing a standardized format for conversion; The converter converts the intermediate representation into the target robot arm’s dedicated programming language, supporting programming languages of multiple vendors; The semantic parser detects potential errors in the converted code and provides an automatic correction mechanism; The peephole optimizer performs instruction optimization, loop unrolling, and memory optimization based on the target hardware characteristics to improve code execution efficiency; Output the final converted target robot arm code and upload it to the controller through the interface; Dynamic adaptation mechanism: During the conversion process, the converter will automatically adjust the code generation rules through a dynamic adaptation mechanism based on the hardware characteristics and programming language specifications of the target robot arm, combined with machine learning optimization strategies. This mechanism gradually optimizes the conversion strategy based on historical conversion data and code execution feedback to ensure that the code generated by each conversion can achieve the best execution effect on the target hardware.
[0017] This article uses specific examples to illustrate the principles and implementation methods of the present invention. The above examples are only used to help understand the method and core ideas of the present invention. The above is only a preferred implementation of the present invention. It should be pointed out that due to the limitations of textual expression and the objective existence of infinite specific structures, ordinary technicians in this technical field can make several improvements, modifications or changes without departing from the principles of the present invention, and can also combine the above technical features in an appropriate manner; these improvements, modifications, changes or combinations, or the direct application of the inventive concept and technical solution to other occasions without improvement, should be regarded as the protection scope of the present invention.
Claims
1. A programming language conversion system in an industrial robot arm, characterized in that: It includes input program code module, symbolic interpreter, algorithm analyzer, syntax parser, converter, semantic parser, peephole optimizer and arm-specific format code output module; The input program code module is used to receive a universal programming language code input by a user; The symbol interpreter uses a symbol recognition algorithm based on regular expressions to perform preliminary analysis on the input code and identify key symbols, variables, functions and operators in the code; The algorithm analyzer analyzes the logical dependencies in the code by constructing control flow graphs and data flow graphs, ensures the integrity of the algorithm logic, and optimizes loop structures and conditional branches; The syntax parser uses a top-down recursive descent parsing method to generate an intermediate representation that is independent of the target programming language, including a three-address code and a static single assignment format; The converter converts the intermediate representation into a dedicated programming language of the target robotic arm based on syntax matching, template replacement and rule mapping techniques, and supports a multi-vendor API adaptation mechanism; The semantic parser detects potential semantic errors in the converted code through static analysis and symbolic execution technology, and provides automatic correction suggestions; The peephole optimizer, based on the Peephole optimization strategy, performs instruction merging, arithmetic operation replacement and memory addressing optimization according to the CPU instruction set characteristics of the target robot arm to improve the code execution efficiency; The arm-specific program code output module supports JSON, XML, YAML and binary formats, and provides an interface for direct uploading to the robotic arm controller.
2. The programming language conversion system in an industrial robot arm according to claim 1, characterized in that: The symbol interpreter adopts a method based on regular expressions and abstract syntax tree analysis to efficiently identify variable scopes, namespaces and recursive call structures in the code, thereby achieving consistency in cross-language conversion.
3. The programming language conversion system in an industrial robot arm according to claim 1, characterized in that: The algorithm analyzer adopts static analysis technology, optimizes the code structure through control flow graph, performs loop expansion, dead code deletion, branch prediction and other optimizations, so as to improve the execution efficiency of the converted code.
4. The programming language conversion system in an industrial robot arm according to claim 1, characterized in that: The syntax parser adopts a multi-level parsing strategy, including lexical analysis, syntax analysis and semantic analysis, and generates an intermediate representation that can be adapted to different programming languages, supporting three-address code, static single assignment and other language-independent code formats.
5. The programming language conversion system in an industrial robot arm according to claim 1, characterized in that: The converter adopts a modular design and has a plug-in extension mechanism. It defines conversion rules through a domain-specific language and combines the target robot arm API adaptation layer to achieve dynamic code conversion and optimization.
6. The programming language conversion system in an industrial robot arm according to claim 1, characterized in that: The semantic parser detects errors in the converted code based on rule matching and machine learning technology, including undefined variables, type mismatches, unreachable codes, etc., and provides an automatic correction mechanism.
7. The programming language conversion system in an industrial robot arm according to claim 1, characterized in that: The peephole optimizer performs specific optimizations for different robotic arm CPU instruction sets, including: instruction merging, loop unrolling, and memory access optimization. The instruction merging is used to reduce repeated operations, the loop unrolling is used to optimize loop iterations, and the memory access optimization is used to reduce unnecessary memory reads.
8. The programming language conversion system in an industrial robot arm according to claim 1, characterized in that: The arm-specific program code output module supports multiple output formats, including JSON, XML, YAML and binary files, and is compatible with control interface protocols of different robotic arms, including MODBUS and PROFINET.
9. A control method for a programming language conversion system in an industrial robot arm according to any one of claims 1 to 8, characterized in that: The following steps are involved: S1: receiving a general programming language code input by a user; S2: Perform symbol recognition through symbol interpreter to extract code structure information; S3: Analyze control flow and data flow through the algorithm analyzer to extract the core computing logic; S4: Generate intermediate representation through syntax parser; S5: Perform language conversion based on syntax matching, template replacement and API adaptation through the converter; S6: Detect potential errors in the converted code through the semantic parser and automatically correct them; S7: Peephole optimization is performed through the peephole optimizer; S8: Output the final converted target robot arm code and adapt it to different interface protocols.
10. The control method of a programming language conversion system in an industrial robot arm according to claim 1, characterized in that: The converter adopts a dynamic adaptation mechanism during the conversion process, based on the hardware characteristics and programming language specifications of the target robotic arm, combined with a machine learning optimization strategy, to automatically adjust the code generation rules to improve the execution efficiency and compatibility of the code.