Code conversion method and device

A technology of code conversion and source code, which is applied in the field of code conversion methods and devices, can solve problems such as increased platform coupling and load, lack of versatility, and inability to run business codes, and achieve the effect of reducing development

Active Publication Date: 2020-05-29
北京水滴科技集团有限公司
View PDF8 Cites 16 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0002] At present, executable file formats under different operating systems or platforms may be different, resulting in the inability of common business codes to run on different operating systems or platforms, increasing code development costs and maintenance costs
[0003] In related technologies, by designing an open-source applet framework, a set of codes is converted into different applet-side and client-side frameworks; after executing the corresponding packaging commands, multi-terminal code compilation is performed; Parse into an abstract syntax tree, then traverse and replace the abstract syntax tree, and finally generate a new abstract syntax tree to adapt to various platforms. However, this method can only target specific platforms and has no universality
Others convert specific high-version syntax into syntax supported by low-version platforms by embedding code conversion tools. This method not only increases the coupling and load of the platform, but also has no versatility.
[0004] For the above-mentioned problems existing in related technologies, no effective solution has been found yet

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Code conversion method and device
  • Code conversion method and device
  • Code conversion method and device

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 2

[0080] In this embodiment, a code conversion device is also provided, which is used to implement the above embodiments and preferred implementation modes, and what has been explained will not be repeated here. As used below, the term "module" may be a combination of software and / or hardware that realizes a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementations in hardware, or a combination of software and hardware are also possible and contemplated.

[0081] Figure 4 is a structural block diagram of a code conversion device according to an embodiment of the present invention, such as Figure 4 As shown, the device includes: an acquisition module 40 for obtaining a source code file; a conversion module 42 connected to the above acquisition module 40 for compiling the source code file into an abstract syntax tree AST according to the grammatical structure information of the source code file, ...

Embodiment 3

[0091] In this embodiment, a code conversion system is also provided, which is used to implement the above embodiments and preferred implementation manners, and what has been explained will not be repeated here. As used below, the term "module" may be a combination of software and / or hardware that realizes a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementations in hardware, or a combination of software and hardware are also possible and contemplated.

[0092] According to another embodiment of the present invention, a code conversion system is provided, Image 6 is a structural block diagram of a code conversion system provided by an embodiment of the present invention, such as Image 6 As shown, the system includes: a source platform 60 and a plurality of target platforms 62, wherein the source platform 60 includes: an acquisition module for acquiring source code files; a first conversion m...

Embodiment 4

[0094] An embodiment of the present invention also provides a storage medium, in which a computer program is stored, wherein the computer program is set to execute the steps in any one of the above method embodiments when running.

[0095] Optionally, in this embodiment, the above-mentioned storage medium may be configured to store a computer program for performing the following steps:

[0096] S1, obtaining the source code file;

[0097] S2. Compile the source code file into an Abstract Syntax Tree AST according to the grammatical structure information of the source code file, wherein the grammatical structure information at least includes: the grammar of the source code file, and the format of the source code file , the label of the source code file;

[0098] S3. Send the AST to a target platform, where the target platform is used to convert the AST into an object code of the target platform.

[0099] Optionally, in this embodiment, the above-mentioned storage medium may a...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The embodiment of the invention discloses a code conversion method and device, and the method comprises the steps: obtaining a source code file; compiling the source code file into an abstract syntaxtree AST according to syntax structure information of the source code file, wherein the syntax structure information at least comprises syntax of the source code file, the format of the source code file and a label of the source code file; and sending the AST to a target platform, wherein the target platform is used for converting the AST into a target code of the target platform. Through the embodiment of the invention, the technical problem that codes of different platforms are incompatible in related technologies is solved, so that the development and maintenance cost of codes of differentplatforms is reduced.

Description

technical field [0001] The present invention relates to the field of computers, in particular to a code conversion method and device. Background technique [0002] At present, executable file formats under different operating systems or platforms may be different, resulting in the inability of common business codes to run on different operating systems or platforms, increasing code development costs and maintenance costs. [0003] In related technologies, by designing an open-source applet framework, a set of codes is converted into different applet-side and client-side frameworks; after executing the corresponding packaging commands, multi-terminal code compilation is performed; Parse it into an abstract syntax tree, then traverse and replace the abstract syntax tree, and finally generate a new abstract syntax tree to adapt to various platforms. However, this method can only target specific platforms and is not universal. Others convert specific high-version syntax into sy...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Applications(China)
IPC IPC(8): G06F8/41
CPCG06F8/42G06F8/447
Inventor 刘恒
Owner 北京水滴科技集团有限公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products