CN110109681A - The conversion method and system of code between different platform - Google Patents
The conversion method and system of code between different platform Download PDFInfo
- Publication number
- CN110109681A CN110109681A CN201910380916.7A CN201910380916A CN110109681A CN 110109681 A CN110109681 A CN 110109681A CN 201910380916 A CN201910380916 A CN 201910380916A CN 110109681 A CN110109681 A CN 110109681A
- Authority
- CN
- China
- Prior art keywords
- platform
- code
- under
- service code
- conversion
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/51—Source to source
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/75—Structural analysis for program understanding
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/30—Computing systems specially adapted for manufacturing
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
- Document Processing Apparatus (AREA)
Abstract
The invention discloses the conversion method and system of code between a kind of different platform, the code includes service code, and the conversion method includes: that the service code under the first platform is converted to syntax tree by crossover tool;Batch processing is carried out to obtain the service code under the second platform corresponding with the service code under first platform to the node content in the syntax tree according to preset transformation rule.The present invention can realize multi-platform use in the case where only developing a set of code, workload and the development cycle of developer can thus be reduced, the learning cost under different platform and the maintenance cost to code under different platform are also reduced simultaneously, on the other hand, also the upper linear velocity for substantially increasing related APP, makes user experience more preferably.
Description
Technical field
The present invention relates to computer information technology field, in particular between a kind of different platform the method for the conversion of code and
System.
Background technique
With the rapid development of computer information technology, various types of APP (application) are continued to bring out, developer
It is generally necessary to develop identical APP under different platforms, common practice is that exploitation meets not respectively under different platform
With the APP of syntax rule under platform and the identical function of bottom framework.
Summary of the invention
The technical problem to be solved by the present invention is to need repeatedly to develop under more middle different platforms in the prior art to overcome
The defect of said function APP provides the conversion method and system of code between a kind of different platform.
The present invention is to solve above-mentioned technical problem by following technical proposals:
The present invention provides a kind of conversion method of code between different platform, the code includes service code, and described turn
The method of changing includes:
By crossover tool, the service code under the first platform is converted into syntax tree;
Wherein the service code both includes page address portions, also includes components.
Batch processing is carried out to the node content in the syntax tree according to preset transformation rule to obtain and described the
The service code under corresponding second platform of service code under one platform.
Preferably, according to preset transformation rule in the syntax tree node content carry out batch processing with obtain with
The step of service code under corresponding second platform of service code under first platform includes: to be examined by the syntax tree
The event and function in service code under the first platform of Suo Suoshu;Corresponding with the event and function turn is retrieved in registration table
Rule is changed, and the transformation rule retrieved is put into syntax tree the corresponding position with the event and function;The registration
In table include the preset event by under the first platform and function convert to the second platform under corresponding event and function turn
Change rule;By the crossover tool, the syntax tree is converted into the service code under the second platform;
And/or
By crossover tool, before the step of service code under the first platform is converted to syntax tree further include: will be described
Service code under first platform carries out standardization processing;
And/or
Before the step of retrieving transformation rule corresponding with the event and function in registration table further include: compare the first platform
Under service code and the second platform under service code to obtain the discrepancy of service code under two platforms;According to the difference
Point, makes registration table, and the transformation rule in the registration table includes syntax conversion, relies on any one of injection, plug-in unit injection;
And/or
The type of the service code includes: production cycle event handling, route processing, state processing, static file, figure
The processing of piece resource and any one of color theme processing and storage processing;
And/or
The crossover tool is AST (abstract syntax tree).
Preferably, the code further includes skeleton code;The conversion method includes:
Mapping library is defined, includes that the preset skeleton code by under first platform is converted to institute in the mapping library
State the transformation rule of the skeleton code under the second platform;The skeleton code under first platform is converted by the mapping library
For the skeleton code under second platform;
And/or
By the crossover tool, after the step of syntax tree is converted to the service code under the second platform, also wrap
It includes: the parameter of change the first platform front-end code, so that the theme of the theme of first platform and second platform
Match.
Preferably, the code under first platform is stored in the first file;
Code under second platform is stored in the second file;
The conversion method further include:
It traverses first file and is divided into the code in first file different classes of, the classification includes
Service code, skeleton code and normal codes;The normal codes are the identical code under the first platform and the second platform;
The normal codes are copied in second file.
Preferably, the conversion method further include:
It whether detects under the preset path in second file comprising conversion corresponding with each preset path
File, if so, converting successfully.
The present invention also provides a kind of converting system of code between different platform, the code includes service code, described
Converting system includes syntax tree conversion module and service code conversion module;
The syntax tree conversion module is used to that the service code under the first platform to be converted to grammer by crossover tool
Tree;
The service code conversion module be used for according to preset transformation rule to the node content in the syntax tree into
Row batch processing is to obtain the service code under the second platform corresponding with the service code under first platform.
Wherein the service code both includes page address portions, also includes components.
Preferably, the service code conversion module includes: fact retrieval unit, for retrieving institute by the syntax tree
State the event and function in the service code under the first platform;Transformation rule retrieval unit, for retrieve in registration table with it is described
Event and the corresponding transformation rule of function, and the transformation rule retrieved is put into syntax tree pair with the event and function
The position answered;In the registration table include the preset event by under the first platform and function convert to the second platform under it is corresponding
Event and function transformation rule;The syntax tree is converted to for by the crossover tool by transcoding unit
Service code under two platforms;
And/or
The converting system further include: specification module, for the service code under first platform to be standardized
Processing;
And/or
The converting system further include: comparison module and registration table make module;The comparing unit is for comparing first
The service code under service code and the second platform under platform is to obtain the discrepancy of service code under two platforms;The registration
Table makes module and is used for according to the discrepancy, makes registration table, the transformation rule in the registration table include syntax conversion, according to
Rely any one of injection, plug-in unit injection;
And/or
The type of the service code includes: production cycle event handling, route processing, state processing, static file, figure
The processing of piece resource and any one of color theme processing and storage processing.
And/or
The crossover tool is AST.
Preferably, the code further includes skeleton code;The converting system includes: mapping block and skeleton code conversion
Module;
The mapping block for defining mapping library, include in the mapping library it is preset will be under first platform
Skeleton code is converted to the transformation rule of the skeleton code under second platform;
The skeleton code conversion module is used to convert the skeleton code under first platform by the mapping library
For the skeleton code under second platform;
And/or
The converting system further include:
Theme matching module, for changing the parameter of the first platform front-end code, so that the master of first platform
It inscribes and matches with the theme of second platform.
Preferably, the code under first platform is stored in the first file;
Code under second platform is stored in the second file;
The converting system further include: spider module and normal codes conversion module;
The spider module is for traversing first file and the code in first file being divided into difference
Classification, the classification include service code, skeleton code and normal codes;The normal codes are flat in the first platform and second
Identical code under platform;
The normal codes for being copied in second file by the normal codes conversion module.
Preferably, the converting system further include:
Correction verification module, for detect under the preset path in second file whether include and each default road
The corresponding transformed document of diameter, if so, converting successfully.
The positive effect of the present invention is that:
The difference that the present invention is realized by comparing code under two platforms, and industry is realized according to the difference of two platforms respectively
The conversion being engaged between code, skeleton code and normal codes, it is mostly flat so as to be realized in the case where only developing a set of code
The use of platform, thus workload and the development cycle of developer can be reduced, while also reducing the study under different platform
On the other hand cost and maintenance cost to code under different platform also substantially increase the upper linear velocity of related APP, make
User experience is more preferably.
Detailed description of the invention
The flow chart of Fig. 1 conversion method of code between the different platform of embodiment 1.
Fig. 2 is the schematic diagram of certain section business code of the step 11 of embodiment 1 in concrete application scene.
Fig. 3 is the part grammar tree graph after the service code conversion in Fig. 2 of embodiment 1.
The flow chart of Fig. 4 conversion method of code between the different platform of embodiment 2.
Fig. 5 be embodiment 2 the first platform under obtain the schematic diagram of a certain picture approach.
Fig. 6 be embodiment 2 the second platform under obtain the schematic diagram of a certain picture approach.
Fig. 7 is the demonstration graph of the registration table in embodiment 2.
The step flow chart of the skeleton code conversion of Fig. 8 conversion method of code between the different platform of embodiment 2.
Whether Fig. 9 converts successful implementation schematic diagram to code under concrete scene for embodiment 2.
The module diagram of Figure 10 converting system of code between the different platform of embodiment 3.
Figure 11 is the module diagram of the service code conversion module of embodiment 3.
Specific embodiment
The present invention is further illustrated below by the mode of embodiment, but does not therefore limit the present invention to the reality
It applies among a range.
Embodiment 1
A kind of conversion method of code between different platform is present embodiments provided, the conversion method includes:
Step 11 passes through crossover tool, and the service code under the first platform is converted to syntax tree;
Step 12 retrieves event and function in service code under first platform by the syntax tree;
Transformation rule corresponding with the event and function in step 13, retrieval registration table, and the conversion retrieved is advised
Corresponding position with the event and function is then put into syntax tree;
In the registration table include the preset event by under the first platform and function convert to the second platform under it is corresponding
Event and function transformation rule;
Step 14 passes through the crossover tool, and the syntax tree is converted to the service code under the second platform.
In the present embodiment, the conversion between syntax tree and code is realized by AST, wherein being converted to for the first time flat by first
Code under platform is converted into syntax tree, is converted to the code be converted to updated syntax tree under the second platform, Fig. 2 for the second time
For under a certain concrete scene, the schematic diagram of certain section business code under the first platform, Fig. 3 is the schematic diagram of partial syntax tree,
As shown in Figures 2 and 3, the syntax tree service code in Fig. 2 being quickly converted into Fig. 3 may be implemented by AST, so as to
To realize the batch operation to code.
In the present embodiment, by the way that the service code under the first platform is converted to syntax tree, then will be in registration table by AST
Corresponding function and event are converted into the service code under the second platform, so as to realizing mass to the first platform under
Corresponding function and event handling make same function without second of exploitation, to realize efficient program development, significantly
The workload for reducing developer also improves the upper linear velocity of program.
Embodiment 2
The conversion method for present embodiments providing code between a kind of different platform, shown in institute Fig. 4, the conversion method packet
It includes:
Step 21 compares the service code under service code and the second platform under the first platform to obtain industry under two platforms
The discrepancy of business code;
Step 22, according to the discrepancy, make registration table;
In the registration table include the preset event by under the first platform and function convert to the second platform under it is corresponding
Event and function transformation rule;
Service code under first platform is carried out standardization processing by step 23;
Step 24 passes through crossover tool, and the service code under the first platform is converted to syntax tree;
Step 25 retrieves event and function in service code under first platform by the syntax tree;
Transformation rule corresponding with the event and function in step 26, retrieval registration table, and the conversion retrieved is advised
Corresponding position with the event and function is then put into syntax tree;
Step 27 passes through the crossover tool, and the syntax tree is converted to the service code under the second platform.
Wherein, the type of the service code includes production cycle event handling, route processing, state processing, static text
Part, picture resource processing and any one of color theme processing and storage processing.In order to better understand the present invention, this implementation
The difference between the code for obtaining picture under two platforms under concrete scene is illustrated in example, as shown in figure 5, in box
The part require is the mode that a certain picture path is obtained under the first platform, interior in the subsequent round bracket of require in figure
Holding is specific path of a certain picture under the first platform.As shown in fig. 6, the uri in box is to obtain certain under the second platform
The path fashion of one picture, wherein the content behind uri in quotation marks is specific path of a certain picture under the second platform.This reality
It applies in example, be converted to by way of being defined in registration table and obtaining picture under the first platform and obtain picture under the second platform
Mode transformation rule, thus realize two platforms under obtain pictorial manner conversion.
Wherein service code both includes page address portions, also includes components.
Wherein, the transformation rule in registration table includes syntax conversion, relies on injection, plug-in unit injection etc., syntax conversion is general
The difference of syntax rule in function or event is pertained only to, relying on injection can generally be related to across file process, and plug-in unit injection is generally
Be related to call directly is used to handle certain types of file.
In the present embodiment, by defining different transformation rules in registration table, so as to improve entire conversion process
Flexibility, reduce developer workload, also improve the maintainability of whole flow process.
In the present embodiment, by comparing the difference of two platforms in advance to which production is for the registration of corresponding function under two platforms
Table greatly improves conversion speed so that the quick calling to implementation rule in registration table may be implemented in specific conversion process
Degree, in addition, can be realized faster, more accurately to avoid the mistake in conversion process by the standardization processing to service code
The conversion between code under different platform.
Fig. 7 is the demonstration graph of registration table made in the present embodiment, as shown in fig. 7, the colon left side be each function or
The title of person's event, the implementation rule of the colon left side function on the right of colon.
In the present embodiment, all codes under the first platform are all placed in the first file, all under the second platform
Code is all placed in the second file.By the way that different codes is placed in different files, can be convenient developer into
Row is checked, obscuring between code under two platforms is also avoided.
Since the implementation of function each under different platform may be different, some may relate to Service Component and bottom
Layer, some may be the difference of syntax rule, the possibility that has is not different, so in the present embodiment, to all codes into
It is further comprised the steps of: before row conversion
It traverses first file and is divided into the code in first file different classes of, the classification includes
Service code, skeleton code and normal codes;
Wherein, different to the processing mode of different code, for service code, since it essentially consists in the difference of grammer,
So handle it processing mode such as above-mentioned steps 21~27, and for skeleton code, frame difference between app under different platform
Part, essentially consists in the difference of the Service Component that different team provide and bottom layer realization, therefore cannot take such as service code phase
Same mode, so as shown in figure 8, in the present embodiment further include:
Step 31 defines mapping library, includes the preset skeleton code by under first platform in the mapping library
Be converted to the transformation rule of the skeleton code under second platform;
Step 32 is converted to the skeleton code under first platform under second platform by the mapping library
Skeleton code.
In the present embodiment, by one mapping library of manual maintenance, to realize under different platform between the library of corresponding function
Compatibility, so as to so that function and event calling cost free, realize the rapid conversion of skeleton code.For example, if necessary
The code for converting login function, then can define in mapping library by the login function function A.userLogin under the first platform
The method that () is converted to the login function function B.login () under the second platform, to realize that the cost free of skeleton code turns
It changes.
Normal codes described above are then the codes being no difference under the first platform and the second platform, so this implementation
In example, for the method for conversion normal codes use are as follows:
The normal codes are copied in second file.
The conversion between normal codes can be thus achieved through the above steps.
In the present embodiment, by the differentiation to code, can for different types of code with different transformation rules into
Row conversion, therefore the transformation efficiency of code under entire first platform can be made higher, system resource utilization efficiency also can be more
It is high.
It is different since there may be the themes of APP under the first platform and the second platform in the present embodiment, so the present embodiment
In, can with comprising steps of
The parameter of the first platform front-end code is changed, so that the theme of first platform and second platform
Theme matches.
Since the difference between this theme generally pertains only to front end, without regard to specific service part or bottom portion
Point, so need to only change front-end code and its parameter, therefore theme can quickly be carried out by this kind modification and change skin, make code it
Between transfer efficiency it is higher.
In order to detect the code under the whether whole successful conversions to the second platform of the code under the first platform, the present embodiment is also
School inspection need to be carried out to the code after conversion, wherein school inspection can be carried out in the following way:
It whether detects under the preset path in second file comprising conversion corresponding with each preset path
File, if so, converting successfully, if it is not, then convert failed.Fig. 9 is illustrated whether the verification of one of concrete scene is converted
Successful a certain implementation, as shown in figure 9, being preset path in every a line bracket, by being under check and correction preset path
Whether the quantity of the no file having after conversion and file and preset file after whether converting matches can detecte converts
Success.
In the present embodiment, by the verification to the file in the file after conversion, the generation under the first platform can detecte
Whether successful conversion is the code under the second platform to code, so as to improve the accuracy of conversion.
In the present embodiment, it can also include the steps that configuration, and in the engineering of exploitation, by comparing under the first platform
It is different to may be implemented after code conversion under the first platform and second whether APP module has from APP module under the second platform
The identical function of code equal modules under platform, a certain module has advertisement pop-up and does not have under the second platform such as under the first platform
Have, then the APP after needing to configure conversion is under the second platform also without pop-up.
In order to better understand the present invention, the present embodiment is further explained below by a specific example:
Code under first platform is stored in the first file, firstly, traversing to the first file, is traversed
Afterwards, the code under the first platform is divided into service code, skeleton code and normal codes these three types, it is first right for service code
It standardizes, and can be advised according to specification rule predetermined come definition, triggering state, the component etc. to its page
Then service code is converted into syntax tree by AST by generalized, specifically can by the third party library parser of introducing and
Travers is completed, then by the node in syntax tree find in registration table predetermined with industry under the first platform
The corresponding event of business code and function, later by corresponding event and function inserter AST, then will be above-mentioned by the tool
Service code is converted to the service code under the second platform, can specifically be realized by third party library generator, in addition,
For the skeleton code and normal codes under the first platform, then conversion is realized by customized mapping library and duplication respectively,
After the completion of all code conversions, in order to realize that the skin under two platforms is consistent, it can modify to front-end code.Second is flat
All codes under platform are stored in the second file man, and in order to detect the code under the first platform, whether successful conversion is at second
Code under platform can traverse the second file to detect whether the file for having corresponding number under preset path,
If so, converting successfully;After converting successfully, all codes can be executed under the second platform to complete further to survey
Examination, if all codes can carry out, which can be online.
In the present embodiment, by carrying out classification processing to code under the first platform and different classes of code being arranged different
Transformation rule, the conversion of the code under different platform not only may be implemented but also transfer efficiency can be made higher, not only reduced
Learning cost under different platform, also makes code maintenance cost lower, not only reduces workload and the work week of developer
Phase also improves the upper linear velocity of APP, makes user experience more preferably.
Embodiment 3
Present embodiments provide a kind of converting system of code between different platform, wherein in the present embodiment, under the first platform
Code be stored in the first file;Code under second platform is stored in the second file.
Shown in institute Figure 10, the converting system includes: syntax tree conversion module 41, service code conversion module 42, specification
Module 43, comparison module 44, registration table make module 45, mapping block 46, skeleton code conversion module 47, theme matching module
48, spider module 49, normal codes conversion module 50 and correction verification module 51.
Syntax tree conversion module 41 is used to that the service code under the first platform to be converted to syntax tree by crossover tool.
In the present embodiment, which is AST.
Service code conversion module 42 is used to carry out the node content in the syntax tree according to preset transformation rule
Batch processing is to obtain the service code under the second platform corresponding with the service code under first platform.
Wherein, the type of the service code includes: production cycle event handling, route processing, state processing, static text
Part, picture resource processing and any one of color theme processing and storage processing.
Specification module 43 is used to the service code under first platform carrying out standardization processing.
Comparison module 44 is used to compare the service code under the service code and the second platform under the first platform to obtain two
The discrepancy of service code under platform;
Registration table makes module 45 and is used to make registration table, the transformation rule in the registration table according to the discrepancy
Including syntax conversion, rely on any one of injection, plug-in unit injection;.
Mapping block 46 includes the preset frame by under first platform in the mapping library for defining mapping library
Frame code conversion is the transformation rule of the skeleton code under second platform;
Skeleton code conversion module 47 is for being converted to the skeleton code under first platform by the mapping library
Skeleton code under second platform.
Theme matching module 48 is used to change the parameter of the first platform front-end code, so that the master of first platform
It inscribes and matches with the theme of second platform.
Spider module 49 is for traversing first file and the code in first file being divided into inhomogeneity
Not, the classification includes service code, skeleton code and normal codes;The normal codes are in the first platform and the second platform
Under identical code;
The normal codes for being copied in second file by normal codes conversion module 50.
Correction verification module 51 be used to detect under preset path in second file whether comprising with it is each described default
The corresponding transformed document in path, if so, converting successfully.
As shown in figure 11, the service code conversion module 42 in the present embodiment includes: fact retrieval unit 421, conversion rule
Then retrieval unit 422 and transcoding unit 423.
Fact retrieval unit 421 is used to retrieve the event in the service code under first platform by the syntax tree
And function.
Transformation rule retrieval unit 422 is used to retrieve transformation rule corresponding with the event and function in registration table, and
The transformation rule retrieved is put into syntax tree the corresponding position with the event and function;Include in the registration table
The transformation rule of corresponding event and function under preset event and function by under the first platform is converted to the second platform.
Transcoding unit 423 is used to that the syntax tree to be converted to the industry under the second platform by the crossover tool
Business code.
In the present embodiment, the service code under the first platform is converted to by syntax tree by syntax tree conversion module 41, then
Function corresponding in registration table and event are converted into the service code under the second platform by service code conversion module 42, from
And corresponding function and event handling under to the first platform mass may be implemented, make same function without developing second
It is secondary, to realize efficient program development, the workload of developer is greatly reduced, also improves the upper linear speed of program
Degree.
In the present embodiment, the difference of two platforms is compared in advance by comparing module 44, then pass through registration table and make module 45
Production is directed to the registration table of corresponding function under two platforms, to may be implemented in specific conversion process to realization rule in registration table
Quick calling then, greatly improves conversion speed, in addition, can be with to the standardization processing of service code by specification module 43
Avoid the mistake in conversion process, realize faster, the more accurately conversion between the code under different platform.
In the present embodiment, mapping library maintenance is carried out by mapping block 46, to realize corresponding function under different platform
Library between compatibility, can make the calling cost free of function and event by skeleton code conversion module 47, realize frame generation
The rapid conversion of code.
In the present embodiment, differentiation by spider module 49 to code can be for different types of code with different
Transformation rule is converted, therefore the transformation efficiency of code under entire first platform can be made higher, system resource utilization
Efficiency also can be higher.
In the present embodiment, realize that the quick theme under different platform changes skin by theme matching module 48.
In the present embodiment, by the verification of the file in the file after 51 pairs of correction verification module conversions, first can detecte
Whether successful conversion is the code under the second platform to code under platform, so as to improve the accuracy of conversion.
In the present embodiment, by carrying out classification processing to code under the first platform and different classes of code being arranged different
Transformation rule, the conversion of the code under different platform not only may be implemented but also transfer efficiency can be made higher, not only reduced
Learning cost under different platform, also makes code maintenance cost lower, not only reduces workload and the work week of developer
Phase also improves the upper linear velocity of APP, makes user experience more preferably.
Although specific embodiments of the present invention have been described above, it will be appreciated by those of skill in the art that this is only
For example, protection scope of the present invention is to be defined by the appended claims.Those skilled in the art without departing substantially from
Under the premise of the principle and substance of the present invention, many changes and modifications may be made, but these change and
Modification each falls within protection scope of the present invention.
Claims (10)
1. the conversion method of code between a kind of different platform, which is characterized in that the code includes service code, the conversion side
Method includes:
By crossover tool, the service code under the first platform is converted into syntax tree;
Batch processing is carried out to the node content in the syntax tree according to preset transformation rule with obtain with it is described first flat
The service code under corresponding second platform of service code under platform.
2. the conversion method of code between different platform as described in claim 1, which is characterized in that according to preset transformation rule
Batch processing is carried out to obtain corresponding with the service code under first platform the to the node content in the syntax tree
The step of service code under two platforms includes: the thing in the service code retrieved under first platform by the syntax tree
Part and function;Transformation rule corresponding with the event and function in registration table is retrieved, and the transformation rule retrieved is put into
In syntax tree with the corresponding position of the event and function;It include the preset thing by under the first platform in the registration table
Part and the function transformation rule of corresponding event and function under converting to the second platform;By the crossover tool, by institute's predicate
Method tree is converted to the service code under the second platform;
And/or
By crossover tool, before the step of service code under the first platform is converted to syntax tree further include: by described first
Service code under platform carries out standardization processing;
And/or
Before the step of retrieving transformation rule corresponding with the event and function in registration table further include: compare under the first platform
Service code under service code and the second platform is to obtain the discrepancy of service code under two platforms;According to the discrepancy,
Registration table is made, the transformation rule in the registration table includes syntax conversion, relies on any one of injection, plug-in unit injection;
And/or
The type of the service code includes: production cycle event handling, route processing, state processing, static file, picture money
Source processing and any one of color theme processing and storage processing;
And/or
The crossover tool is AST.
3. the conversion method of code between different platform as described in claim 1, which is characterized in that
The code further includes skeleton code;The conversion method includes:
Mapping library is defined, includes that the preset skeleton code by under first platform is converted to described the in the mapping library
The transformation rule of skeleton code under two platforms;The skeleton code under first platform is converted into institute by the mapping library
State the skeleton code under the second platform;
And/or
By the crossover tool, after the step of syntax tree is converted to the service code under the second platform, further includes: more
Change the parameter of the first platform front-end code, so that the theme phase of the theme of first platform and second platform
Match.
4. the conversion method of code between different platform as claimed in claim 3, which is characterized in that
Code under first platform is stored in the first file;
Code under second platform is stored in the second file;
The conversion method further include:
It traverses first file and is divided into the code in first file different classes of, the classification includes business
Code, skeleton code and normal codes;The normal codes are the identical code under the first platform and the second platform;
The normal codes are copied in second file.
5. the conversion method of code between different platform as claimed in claim 4, which is characterized in that the conversion method is also wrapped
It includes:
It whether detects under the preset path in second file comprising transformed document corresponding with each preset path,
If so, converting successfully.
6. the converting system of code between a kind of different platform, which is characterized in that the code includes service code, the conversion system
System includes syntax tree conversion module and service code conversion module;
The syntax tree conversion module is used to that the service code under the first platform to be converted to syntax tree by crossover tool;
The service code conversion module is for criticizing the node content in the syntax tree according to preset transformation rule
Amount processing is to obtain the service code under the second platform corresponding with the service code under first platform.
7. the converting system of code between different platform as claimed in claim 6, which is characterized in that the service code modulus of conversion
Block includes: fact retrieval unit, for retrieved by the syntax tree event in the service code under first platform and
Function;Transformation rule retrieval unit, for retrieving transformation rule corresponding with the event and function in registration table, and will retrieval
To transformation rule be put into syntax tree the corresponding position with the event and function;It include preset in the registration table
By under the first platform event and function convert to the second platform under the transformation rule of corresponding event and function;Code conversion list
Member, for by the crossover tool, the syntax tree to be converted to the service code under the second platform;
And/or
The converting system further include: specification module, for the service code under first platform to be carried out standardization processing;
And/or
The converting system further include: comparison module and registration table make module;The comparing unit is for comparing the first platform
Under service code and the second platform under service code to obtain the discrepancy of service code under two platforms;The registration table system
Make module for making registration table according to the discrepancy, the transformation rule in the registration table includes syntax conversion, relies on note
Enter, plug-in unit injection any one of;
And/or
The type of the service code includes: production cycle event handling, route processing, state processing, static file, picture money
Source processing and any one of color theme processing and storage processing;
And/or
The crossover tool is AST.
8. the converting system of code between different platform as claimed in claim 6, which is characterized in that the code further includes frame
Code;The converting system includes: mapping block and skeleton code conversion module;
The mapping block includes the preset frame by under first platform in the mapping library for defining mapping library
Code conversion is the transformation rule of the skeleton code under second platform;The skeleton code conversion module is used for by described
Skeleton code under first platform is converted to the skeleton code under second platform by mapping library;
And/or
The converting system further include: theme matching module, for changing the parameter of the first platform front-end code, so that institute
The theme for stating the theme and second platform of the first platform matches.
9. the converting system of code between different platform as claimed in claim 8, which is characterized in that
Code under first platform is stored in the first file;
Code under second platform is stored in the second file;
The converting system further include: spider module and normal codes conversion module;
The spider module is different classes of for traversing first file and being divided into the code in first file,
The classification includes service code, skeleton code and normal codes;The normal codes are under the first platform and the second platform
Identical code;
The normal codes for being copied in second file by the normal codes conversion module.
10. the converting system of code between different platform as claimed in claim 9, which is characterized in that the converting system is also wrapped
It includes:
Correction verification module, for detect under the preset path in second file whether include and each preset path pair
The transformed document answered, if so, converting successfully.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910380916.7A CN110109681B (en) | 2019-05-08 | 2019-05-08 | Method and system for converting codes between different platforms |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910380916.7A CN110109681B (en) | 2019-05-08 | 2019-05-08 | Method and system for converting codes between different platforms |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110109681A true CN110109681A (en) | 2019-08-09 |
CN110109681B CN110109681B (en) | 2023-06-09 |
Family
ID=67488882
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910380916.7A Active CN110109681B (en) | 2019-05-08 | 2019-05-08 | Method and system for converting codes between different platforms |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110109681B (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110704053A (en) * | 2019-09-03 | 2020-01-17 | 五八有限公司 | Method and device for processing style information |
CN110716746A (en) * | 2019-09-03 | 2020-01-21 | 五八有限公司 | Method and device for converting RN style code into applet style code |
CN111596965A (en) * | 2020-07-22 | 2020-08-28 | 太平金融科技服务(上海)有限公司 | Project engineering initialization method, device, computer equipment and storage medium |
CN112346730A (en) * | 2020-11-04 | 2021-02-09 | 星环信息科技(上海)股份有限公司 | Intermediate representation generation method, computer equipment and storage medium |
CN112667240A (en) * | 2020-12-23 | 2021-04-16 | 平安普惠企业管理有限公司 | Program code conversion method and related device |
CN114417267A (en) * | 2022-01-24 | 2022-04-29 | 中国电信股份有限公司 | Code obfuscation method, device, electronic device and storage medium |
CN110795099B (en) * | 2019-09-03 | 2023-08-29 | 五八有限公司 | Page style conversion method and device, terminal equipment and storage medium |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR19990039434A (en) * | 1997-11-12 | 1999-06-05 | 정선종 | How to Generate Seed Plus Code from a Lotos Specification |
US20030106049A1 (en) * | 2001-11-30 | 2003-06-05 | Sun Microsystems, Inc. | Modular parser architecture |
CN101841515A (en) * | 2009-03-19 | 2010-09-22 | 北京理工大学 | Target variable protocol data unit codec code automatic generation implementation method |
US20160124936A1 (en) * | 2013-05-28 | 2016-05-05 | Baidu Online Network Technology (Beijing) Co., Ltd. | Grammar compiling methods, semantic parsing methods, devices, computer storage media, and apparatuses |
CN106293677A (en) * | 2015-06-08 | 2017-01-04 | 阿里巴巴集团控股有限公司 | A kind of code conversion method and device |
CN106951404A (en) * | 2017-03-22 | 2017-07-14 | 北京捷成世纪科技股份有限公司 | A kind of conversion method of data format and device |
CN106970820A (en) * | 2017-04-26 | 2017-07-21 | 腾讯科技(深圳)有限公司 | Code storage method and code storage |
CN107861728A (en) * | 2017-10-25 | 2018-03-30 | 深圳四方精创资讯股份有限公司 | Method from traditional program language to modern procedures language conversion and its system for |
CN108874396A (en) * | 2018-05-31 | 2018-11-23 | 苏州蜗牛数字科技股份有限公司 | The cross-compiler and Compilation Method of multi-platform multiple target language based on HLSL |
CN108984163A (en) * | 2018-07-13 | 2018-12-11 | 华东师范大学 | A kind of multi-platform code generating method of isomery formula based on IMCL model |
-
2019
- 2019-05-08 CN CN201910380916.7A patent/CN110109681B/en active Active
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR19990039434A (en) * | 1997-11-12 | 1999-06-05 | 정선종 | How to Generate Seed Plus Code from a Lotos Specification |
US20030106049A1 (en) * | 2001-11-30 | 2003-06-05 | Sun Microsystems, Inc. | Modular parser architecture |
CN101841515A (en) * | 2009-03-19 | 2010-09-22 | 北京理工大学 | Target variable protocol data unit codec code automatic generation implementation method |
US20160124936A1 (en) * | 2013-05-28 | 2016-05-05 | Baidu Online Network Technology (Beijing) Co., Ltd. | Grammar compiling methods, semantic parsing methods, devices, computer storage media, and apparatuses |
CN106293677A (en) * | 2015-06-08 | 2017-01-04 | 阿里巴巴集团控股有限公司 | A kind of code conversion method and device |
CN106951404A (en) * | 2017-03-22 | 2017-07-14 | 北京捷成世纪科技股份有限公司 | A kind of conversion method of data format and device |
CN106970820A (en) * | 2017-04-26 | 2017-07-21 | 腾讯科技(深圳)有限公司 | Code storage method and code storage |
CN107861728A (en) * | 2017-10-25 | 2018-03-30 | 深圳四方精创资讯股份有限公司 | Method from traditional program language to modern procedures language conversion and its system for |
CN108874396A (en) * | 2018-05-31 | 2018-11-23 | 苏州蜗牛数字科技股份有限公司 | The cross-compiler and Compilation Method of multi-platform multiple target language based on HLSL |
CN108984163A (en) * | 2018-07-13 | 2018-12-11 | 华东师范大学 | A kind of multi-platform code generating method of isomery formula based on IMCL model |
Non-Patent Citations (2)
Title |
---|
邓磊等: "一种多目标平台分布式对象模型编译器设计方法", 《西北工业大学学报》 * |
邓磊等: "一种多目标平台分布式对象模型编译器设计方法", 《西北工业大学学报》, no. 06, 15 December 2014 (2014-12-15), pages 159 - 162 * |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110704053A (en) * | 2019-09-03 | 2020-01-17 | 五八有限公司 | Method and device for processing style information |
CN110716746A (en) * | 2019-09-03 | 2020-01-21 | 五八有限公司 | Method and device for converting RN style code into applet style code |
CN110716746B (en) * | 2019-09-03 | 2023-04-07 | 五八有限公司 | Method and device for converting RN style code into applet style code |
CN110795099B (en) * | 2019-09-03 | 2023-08-29 | 五八有限公司 | Page style conversion method and device, terminal equipment and storage medium |
CN111596965A (en) * | 2020-07-22 | 2020-08-28 | 太平金融科技服务(上海)有限公司 | Project engineering initialization method, device, computer equipment and storage medium |
CN111596965B (en) * | 2020-07-22 | 2020-11-03 | 太平金融科技服务(上海)有限公司 | Project engineering initialization method, device, computer equipment and storage medium |
CN112346730A (en) * | 2020-11-04 | 2021-02-09 | 星环信息科技(上海)股份有限公司 | Intermediate representation generation method, computer equipment and storage medium |
CN112667240A (en) * | 2020-12-23 | 2021-04-16 | 平安普惠企业管理有限公司 | Program code conversion method and related device |
CN114417267A (en) * | 2022-01-24 | 2022-04-29 | 中国电信股份有限公司 | Code obfuscation method, device, electronic device and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN110109681B (en) | 2023-06-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110109681A (en) | The conversion method and system of code between different platform | |
US8806452B2 (en) | Transformation of computer programs and eliminating errors | |
CN104391793B (en) | Testing procedure and test script generation method and device | |
CN1454357A (en) | XML-robot | |
CN105808437A (en) | Automation testing method and system based on test case data table | |
CN113051285A (en) | SQL statement conversion method, system, equipment and storage medium | |
CN106326363A (en) | Matching method based on regular expressions and device thereof | |
CN106951231A (en) | A kind of computer software development approach and device | |
CN107679141A (en) | Data storage method, device, equipment and computer-readable recording medium | |
CN105653268A (en) | Rule engine debugging method and rule engine debugging system | |
CN110347709A (en) | A kind of construction method and system of regulation engine | |
KR102096017B1 (en) | Method and system for predicting software bugs by embedding source code based on an abstract syntax tree | |
CN106776266A (en) | The collocation method and terminal device of testing tool | |
US9880863B2 (en) | Methods and systems for increasing processor speed by creating rule engine rules from unstructured text | |
CN107577460A (en) | A kind of method from unstructured data extraction structural data | |
Hue et al. | A transformation-based method for test case automatic generation from use cases | |
CN106919431A (en) | Code comparison method, equipment and system in continuous integrating | |
CN104111917B (en) | Data processing device, data processing method and electronic device | |
CN101272222A (en) | Restriction calibration method and device | |
CN106874192B (en) | Digital publication-oriented standard conformance testing method and system | |
Mokhov | Introducing MARF: a modular audio recognition framework and its applications for scientific and software engineering research | |
US8234597B2 (en) | Tool and method to graphically correlate process and test data with specific chips on a wafer | |
CN106600149A (en) | Process analysis method and apparatus | |
CN106598585A (en) | Scoring-driven fast service matching and aggregating method in cloud environment | |
CN106933848A (en) | A kind of method for sending information and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |