[go: up one dir, main page]

CN101208660A - Code transformation - Google Patents

Code transformation Download PDF

Info

Publication number
CN101208660A
CN101208660A CNA2006800232036A CN200680023203A CN101208660A CN 101208660 A CN101208660 A CN 101208660A CN A2006800232036 A CNA2006800232036 A CN A2006800232036A CN 200680023203 A CN200680023203 A CN 200680023203A CN 101208660 A CN101208660 A CN 101208660A
Authority
CN
China
Prior art keywords
code
tree
node
node type
language
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.)
Pending
Application number
CNA2006800232036A
Other languages
Chinese (zh)
Inventor
阿尔伯特·唐纳德·通金
鲁思·埃玛·通金
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
QUIPOZ Pty Ltd
Original Assignee
QUIPOZ Pty Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Priority claimed from AU2005903390A external-priority patent/AU2005903390A0/en
Application filed by QUIPOZ Pty Ltd filed Critical QUIPOZ Pty Ltd
Publication of CN101208660A publication Critical patent/CN101208660A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

The invention concerns the transformation of executable code from one language to another. In particular, the invention concerns the automated transformation of code. The invention concerns methods, software and computer systems for the creation of a tree comprised of nodes to be used in the transformation of code. The invention also concerns the methods, software and computer systems for the building of a parser to be used in the transformation of code. Finally, the invention also concerns an automated and iterative method of transforming, assessing and re-transforming code. The invention is advantageous in its ability to avoid usage of an intermediate transformation language, and its high level of automation that reduces manual transformation and accordingly is more efficient and less costly.

Description

Code conversion
Technical field
The present invention relates to the conversion of executable code from a kind of language to another kind of language.Specifically, the present invention relates to the automatic conversion of code.
Background technology
Legacy System (legacy system) is outmoded computer system or the application program that comprises tens line codes of being write as with COBOL, PL/I and other ancient programming language usually.
Conversion relates to the process that the application source code that will leave over is converted to modern languages, for example application program is transformed into Java on the J2EE from COBOL, or the application program that RPG is write as is converted to c# on the .NET.Sometimes also conversion is called modernization.
The application program of leaving over is transformed into independently modern technology platform has lot of advantages:
The intellecture property of application program is left in-maintenance;
-make easier in the future and improve with less cost application programs;
-application program can turn in the modern times can provide webpage (Web-enablement); And
-application program can keep original pattern, sensation and function, thereby the training to the worker is minimized.
The application program modern methods based on worktable is used in conversion usually, that is to say, changes based on a series of diverse instruments, and involves a lot of artificial conversions to code usually.
A. Te Likefu (A Terekhov) and C. expense Hough (C Verhoef) is stated in their name is called the paper of " implementation language conversion (The Realities of Language Conversion) " (St. Petersburg state university (St Petersburg State University)): the language switching of robotization seems simply, but is an extremely complicated problems when practical application.They summarize with such statement: do not have the thing as the simple transformation, people should limit them to the quality of conversion engineering and expectation semantically of equal value.
Summary of the invention
First scheme of the present invention is the method that a kind of establishment comprises the tree of a plurality of nodes, and this tree is ready to use in executable code in the conversion of different programming languages, and this method comprises:
Receive described executable code;
Discern each executable section of described code;
Node of each executable section distribution for described code, wherein each node belongs to one of one group of destined node type, but a unique general executable operations of described each destined node type definition programming language, the structure of each node and content are determined by the general operation of its node type definition; With
Link a plurality of nodes to create this tree.
Be cut to its basic meaning by each is carried out section, the grammer difference between the various language just can not reflect in the tree of creating, and this tree is used for code conversion subsequently to different programming languages.If but two parts of code realize same group of executable operations, even if they are write as by different language, two parts of this of code also can generate identical tree.Like this,, therefore code conversion is become easily, and avoided the demand of intermediate language independently because identical method can be applied to multiple programming language.
But described unique general executable operations can be:
To quoting of another code constituent element;
Assignment statement;
DPS;
Conditional statement; Or
Loop statement.
For each node type, its structure comprises one or more child node, and wherein each child node belongs to one of one group of predetermined child node type, but a possibility constituent element of described each its general executable operations of child node type definition.
For example, but the node type of the executable operations of definition assignment statement, can be constructed as first child node that comprises the child node type and second child node of child node type, the target constituent element of this first child node type definition assign operation, the second child node type definition assign operation assignment constituent element.
For each child node type, its structure comprises one or more child node again, wherein each again child node belong to one group of predetermined one of child node type again, but described each one of constituent element of its general executable operations of child node type definition may sub-component again.
For example, above-mentioned second child node can have one group of predetermined child node type again, and it can comprise the child node again of a defining variable or mathematic(al) representation.
In this tree, the variable that uses in the described executable code can appear in this tree explicitly with the child node type of defining variable.
In this tree, the mathematical equation of using in the described executable code can appear in this tree explicitly with the child node type that defines the mathematic(al) representation that uses in the described equation.
In this tree, the constant that uses in the described executable code can appear in this tree explicitly with the child node type of defconstant.
Each node can comprise identifying information, for example distributes to the row number of the executable section in the described executable code.
By distribute to each node link information with this node link to this tree, described link information is with relevant with this node link required other node to this tree, for example the details of the father node of this node and child node.
Each node can have unique identifier.A node can be linked to this tree by having the relevant father node of this node or unique ID of child node.
Each node can further comprise a plurality of methods, and how these a plurality of methods carries out the exercises that are used for the assist process tree if relating to.
Each node can further comprise a marker, and this marker can be used by the described several different methods that is used for the assist process tree; For example, the method for indicating is performed on this node.
Described method can further comprise:
Receive the claim data that is associated with described executable code;
Discern each declare section of described claim data;
Be node of each declare section distribution of described code, this node belongs to the node type of definition statement; And
This declaration node is linked to this tree.
Described claim data can be another code that is associated with described executable code.Described claim data can comprise variable declarations, function declaration or program statement.
Described declaration node comprise following any or more a plurality of:
Aforesaid identifying information;
Aforesaid link information;
Aforesaid a plurality of method; And
Unique identifier.
Alternative plan of the present invention is that a kind of resolver of setting up comprises the method for the tree of a plurality of nodes with establishment, and this tree is ready to use in the conversion of executable code from first programming language to second programming language, and this method comprises:
At described first programming language, but from the code of writing with described first programming language, identify the grammer of definition executable operations;
Be the grammer distribution node type that identifies, wherein each node type is one of one group of destined node type, but a unique general executable operations of described each destined node type definition programming language; The structure of each node type and content are determined by the general operation of its node type definition;
Repeat this method, but all be identified and all be assigned with node type until grammer at all executable operations of described first operating language.
Third party's case of the present invention provides a kind of resolver, and it is used to carry out the method for the present invention's first scheme.This resolver can be set up according to the method for alternative plan of the present invention.
Cubic case of the present invention is a kind of application software that can make the computer system operation with the method for execution the present invention first scheme.
The 5th scheme of the present invention is a kind of application software that can make the computer system running with the method for execution alternative plan of the present invention.
The 6th scheme of the present invention is a kind of executable code to be converted to the computer system of different programming languages, and this computer system has:
Input tool is used to receive described executable code;
Storage tool is used to store the code and the application software that are received; With
Handling implement is used to use described application software to carry out the method for the present invention's first scheme.
This computer system may further include the output instrument, and it is used for exporting described executable code with different programming languages.
The 7th scheme of the present invention is a kind of executable code to be converted to the computer system of second programming language from first programming language, and this computer system comprises:
Storage tool is used to store described executable code and application software; And
Handling implement is used to use described application software to carry out the method for alternative plan of the present invention.
Of the present invention the from all directions case be a kind of executable code to be converted to the method for second programming language from first programming language, described method comprises:
Create tree with the described method of first scheme of the present invention;
At each node on the tree, but the executable operations of definition is transcribed into the grammer of second programming language.
The 9th scheme of the present invention be a kind of be the method for different programming languages with code conversion, this method comprises:
Receive described code;
Create abstract syntax tree based on described executable code;
The recognition data that will be referred to a plurality of processes of rebuilding is stored in the data-carrier store, and described a plurality of processes of rebuilding are treated on described abstract syntax tree operation rebuilding this tree, thereby assist described code conversion of arriving different language;
On described abstract syntax tree, operate in the process of rebuilding that identifies in the described data-carrier store automatically;
Automatic operation configuration process on the tree of this reconstruction is being described different programming language with described code conversion;
Code after the assessment conversion, and based on this assessment, identify another and treat that operation is to assist the described process of rebuilding that arrives the code conversion of different language on described abstract syntax tree;
The recognition data of described another process of rebuilding is stored in the described data-carrier store; And
Repeat described operating procedure.
Utilize each iteration, source code is repeated conversion and analyzes, thereby make code after the conversion, and have more maintainability better qualitatively.Each time iteration generates the code after the more compatible and conversion that adapts to of architecture with newspeak.
When only providing the high automation level in conversion process, the iterative scheme of this code conversion just becomes possibility.If in operating procedure, comprise artificial data conversion, then obtain optimum code iterative scheme cost and pay and may be restricted.Further, by carrying out the process that in data-carrier store, identifies, between iteration, can limit again dynamically conversion.
Code can receive from the owner of code there.This method can also comprise reception data dictionary, metadata or all other files relevant with the code that is received.
Abstract syntax tree can be according to the described tree of the present invention's first and second schemes.The method that this abstract syntax tree can use the present invention's first scheme to describe is created.
This method may further include: described abstract syntax tree is stored in step in the described data-carrier store.
The step of described establishment abstract syntax tree further comprises: extract the statement element from described abstract syntax tree, and it is stored in the data-carrier store.Described statement element utilizes a plurality of excavation processes to extract from described abstract syntax tree, and described a plurality of excavation processes are excavated to discern the statement element in this tree described abstract syntax tree.Described each statement attribute of an element also can be stored in the described data-carrier store.
Described method can further comprise: will analyze data storage in described data-carrier store, described analysis data relate to the element that how to use and use described code wherein.
With described code conversion is that the step of abstract syntax tree may further include: described abstract syntax tree is saved in the data-carrier store.
Described method comprises the step of metadata store in described data-carrier store about described code.Described metadata manually can be write in the entry data memory.Described metadata can comprise the information about the source language of described code and/or described different programming language, and described metadata can comprise the information about the built-in constituent element of the source language of described code and/or described different programming language.Described metadata can also comprise the other information that relates to reconstruction, for example required maintainability, complicacy and efficient when the operation of code of conversion.
Replacedly, or in addition, can use a plurality of excavation processes, extract described metadata from described abstract syntax tree, this excavation process can be excavated described abstract syntax tree, so that determine the metadata of code.
Described process of rebuilding can comprise following one or more:
The process of hoping loop structure is by a definite date discerned and is rebuild in circulation;
The more process of fine structure is discerned and be redeveloped into to specific executable section;
GOTO statement in the described abstract syntax tree is discerned, laid equal stress on and contribute to remove the process of these statements;
Duplicate to the one-tenth group node in this tree is discerned, and rebuilds so that this group node is created as the process of function or process;
The process that the action scope of one or more variable is discerned;
Particular node group in the described abstract syntax tree is discerned, and reset the process of the structure of these nodes;
Particular node group in the described abstract syntax tree is discerned, and replaced the process of these nodes, for example used function call;
Data structure is changed into the process of the 3rd canonical form;
Travel through the process of this tree with the identification interface; And
Travel through the purposes of this tree and situational variables, to improve the process of its types of variables.
Described method can further comprise writes the described process of rebuilding moved treated on abstract syntax tree.
Described method can further comprise being stored in the information and executing audit in the described data-carrier store, have or not information dropout with identification.
The described step that operates in the process of rebuilding that identifies in the described data-carrier store automatically, also use be stored in the described data-carrier store with code dependent claim information and metadata information.
Described process can be moved simultaneously.
The step of described automatic operation configuration process also can be used in the described data-carrier store and the code dependent information of being stored in.
To the assessment of the code after the conversion based on following any one or more multinomial:
The order complicacy of described code;
The line number of code;
The number of the process that has been replaced;
The manual evaluation of the code after the conversion; And
The accuracy of the code after the configuration.
The step of the code after the described assessment conversion can be based on described abstract syntax tree.
Code after the described assessment conversion comprises: generate the objection report, possibly can't produce required result's part in the code after the described conversion of described objection report identification.
Before the code after the assessment conversion, described method can comprise: with the step of the code storage after the described conversion in described data-carrier store.This may comprise the code after the conversion of the preceding iteration of this method is replaced with code after the latest edition conversion.。
Described data-carrier store is same data-carrier store.
The tenth scheme of the present invention is a kind of application software that can carry out according to the method for the present invention all directions case.
The 11 scheme of the present invention is a kind of the present invention the computer system of the method for case from all directions that is programmed to carry out.This computer system is used for transcode, and this computer system has:
Input tool is used to receive described code;
Storage tool is used to store the code of application software and reception; And
Handling implement is used to use described application software to carry out the method for the present invention all directions case.
Described computer system further comprises the data-carrier store that is used to store the above information.
Description of drawings
Referring now to accompanying drawing best mode of the present invention is described, wherein:
Fig. 1 is the schematic diagram of the constituent element of converting system;
Fig. 2 (a) to Fig. 2 (c) be the process flow diagram of technical finesse of the present invention;
Fig. 3 is a transform engine;
Fig. 4 is the structure of the needs of IF statement node;
Fig. 5 is the syntax tree example by two row C code establishings;
Fig. 6 illustrates the analysis of C code snippet;
Fig. 7 is based on two identical row C codes, uses the example of the standard tree of the present invention's establishment;
Fig. 8 is the example of knowledge base class hierarchy;
Fig. 9 illustrates the example of logic tree;
Figure 10 is the example of false code; And
Figure 11 is the false code that is converted to the C language.
Embodiment
The method of one aspect of the invention comprises a plurality of steps that repeat.The purpose of each iteration is to generate the best in quality as much as possible and dispose code accurately.Have only the tree reconstruction and the configuration of robotization just to make iteration become possibility.If these steps are manually carried out, even can determine better method or preferable result so, the repeating step of conversion also can the restriction to some extent owing to cost and matter of time.Iterative scheme guarantees the most feasible transcode by the code of conversion being improved when the each iteration.Further, even configuration process begins, also can realize requirement to the code of conversion.
With reference now to Fig. 1, the constituent element of converting system is described.Transform engine is divided into three groups of serial processes that iteration is carried out.
Input is handled 20 pairs of input languages of constituent element and is carried out lexical analysis (lex) and resolve to one group of linguistic notation (token) and abstract logic tree.Linguistic notation is applied to variable and operational character (operator).Operational character and variable are actually the superset of existing language for the part of the wide spectrum language (WSL, wide spectrum language) of exploitation, this language.All constituent elements all are stored in the knowledge base, visit simultaneously for a plurality of processes.
A plurality of processes that 22 storages of enhancement process device (enrichment processor) constituent element are carried out by the small-sized code constituent element that is called walker (walker), these small-sized code constituent elements have such ability: navigate within standard tree (Standard Tree), and carry out a plurality of tasks, for example tree is excavated, tree is rebuild and tree is configured to another kind of language at information.All reconstructions all are restricted to format conversion, and this permission is rebuild under the situation that does not change function.The example of rebuilding is other statement that depends in the program of preceding execution, identifies GO TO statement and can be converted to DO WHILE statement.
Standard tree and the knowledge base that constituent element 24 traversals are rebuild handled in output, generates configurable code with target language.
All processing can be carried out on one or more processor of computer system.Computer system have can install, make processor carry out the software of method of the present invention.Computer system comprises the input tool that receives code, the CD driver that the portable hard drive that for example can admit the CD that stores code maybe can admit to store code is moving.Computer system also comprises the suitable storage tool as Quipoz knowledge base (below describe in further detail) operation.This storage tool is stored the software of for example carrying out this method, code to be converted and the code in the transfer process.This computer system can comprise discrete computing machine, and these computing machines all have the processor of cross-assignment processing of the present invention thereon.
Walker is known the metadata needs (metadata requirement) of appointment in metadata knowledge base (meta-data repository).This makes and can dynamically limit again switch target between iteration.
Fig. 2 (a) to Fig. 2 (c) be the process flow diagram of converting system application programs employed technical finesse when changing.These are handled by adopting unique constituent element to realize separately target, below these constituent elements are described more fully.
At first must gather 30 to the source.Can adopt multiple different form that application program source is sent to converting system.Most common language, COBOL for example, be fully forward-each programs of these language receives as a file, each program comprises all required information of this program run: variable-definition, file relation etc.This language is called " being the center with the program " (Program-Centric) language.
Other Languages, especially 4GL are not so simple just.Usually, code translator (coder) uses integrated development environment, and the screen that it is included as customization is used to import only to the data that specific function is specific.Client can not seen single " program "-but see a series of constituent elements usually.(itself can not compile this program listing because conversion must service routine be tabulated, and often lack crucial relation information, or have a note that spreads in the code), maybe must attempt the information that remains in the private database is deciphered, so the very challenging property of these situations.Under any situation, some preparation works are arranged all.Usually, all variable-definitions of all programs all are stored in the file; All code storage of all programs are in another file; All screens (screen) definition is stored in another file, etc.Such language is called " non-be with the program center " language.
In both cases, information can be from other source.For example, the data dictionary file even they are out of step with the times, but also can provide some valuable information.
In this process next step is process analysis 32, wherein the material that receives analyzed, so that determine the order (a course of action) of action.If language to be converted is not the center with the program, need to determine whether to have used program listing or private database so.Usually, little test procedure need be issued the client that they move, thereby can determine the action of this language under difficult situation.
Usually be that property file (properties file) is set up in specific conversion in this stage.Identical with other stage, this property file comprises metadata, and what these metadata process of informing was read in is any language, configuration be any language, where find source code and use which database.
To all engineerings, process analysis 32 almost always needs to carry out pre-service.For example, if the service routine tabulation needs to carry out pre-service, so that remove page break and printer command as source code so.Under a few cases, for understanding language better and use pre-service, so that utilize the coding standard of client.
Most of pre-service are specific for language and source format.
Then, standard tree is arrived in each language constituent element mapping 34.That is to say, need understand each statement and statement, and statement and statement are mapped to respective item in the standard tree.For example, the statement among the COBOL " MOVE A TO B " is simple assignment statement, and it is mapped as this intermediate item on the standard tree.
Hereinafter further go through standard tree again.
For every kind of language constituent element is created 36 lexical analyzers (lexer) and resolver.For the process of writing out lexical analyzer and resolver is quickened, these projects are write as with the language that is called ANTLR usually.Yet,, only encode, otherwise be not this situation for receive figured screen for converting system.
Though can make lexical analyzer at any time, could make after being used for by the time input language to be mapped to standard tree to the resolver that standard tree was resolved and set up simultaneously to language.This be since the structural change of standard tree to be created the mode that language is divided.This is one of key difference between language parser of the present invention and the standard language resolver.When input language was come in, the standard language resolver was only discerned input language.The barment tag of all trees of creating is all similar to this language.Yet the present invention uses analyzing step that each constituent element is discerned, named, and the creating a standard tree.
As an example, can compare using tree and the tree of the present invention that the free C resolver that obtains generates on network.The both uses ANTLR to create, yet the tree that both set up is very different.
The C resolver of standard run in the input source " when (", should " (" be categorized as left parenthesis (LEFT-PARENTHESIS) node.Yet, resolver of the present invention deeper excavates this code, determine that this left parenthesis is the expression compute sign, distinguishes the beginning that is delivered to a row parameter of function call to be passed, distinguishes the row parameter statement in the function declaration, or the beginning of bracketed expression formula in the mathematical equation.Further, in a single day resolver of the present invention identifies the effect of specific left parenthesis, then determines the position under this project in present tree---may be different from the position that in the C code, physically writes.
Then, to discerning 38 as all tree walkers (Tree Walker) that the source is written into the part of process.Sometimes, can not generate standard tree fully by resolver.This is because at some specific areas, input language and standard tree difference are very big, so directly be mapped as too complexity of standard tree in a step.In this case, create tree walker, carry out this process by tree walker.
Because these tree walkers extract tree in the input language form, and be the standard tree form, so these tree walkers are specific to the input source language, and can't move with any other input language with the input language format conversion.
Can in RPG, obtain such example.In the statement part of RPG program, be used for the parameter that following procedure calls and be stored in tabulation.Then, at the logical gate of program, when existing to the calling of another program, these tabulations of call parameters.Yet standard tree need be associated itself all parameters of routine call with the program of calling.Because this was difficult to carry out in the parsing period, therefore after resolving, adopt tree walker, obtain all parameter lists by tree walker, and they are put into the call statement of this program.
In case write out language parser, and write out all input tree walkers, move resolver at all input sources 40 so and tree walker is exactly a simple question.This step can be configured at all codes or only move (by InScopeItem control) at particular items.
The result of this step is converted to the wide spectrum language of representing with standard tree (WSL) with input language.
In case with code analysis is the standard tree form, then,, and be stored in the knowledge base so that extract claim information at the code operation delver 42 of resolving.Each delver is only at specific node type traversal standard tree structure---declaration node type normally.For example, there is a delver of in program, searching all method statements, a delver of searching all routine calls, a delver of searching all SQL statement.
Then, these delvers are stored in all claim information in the knowledge base.This knowledge base is preserved the project (for example variable) of all names, with their attribute (for example length, input language data type etc.) and the relation of they and other project of being named (the function F xl that for example has variable MyVar quotes the function F xl of DB Table ClientDetails).
In case finish this step, just we can say to be written into application program.
Next step is identification and all built-in constituent elements (" built-in " component) 44 of understanding input language.This step need not moved at this, unless be about to generate Audit Report.
Be necessary all built-in constituent elements-for example, discern as the function that a part provided of running environment or language to language.These functions are very general in 4GL.Before conversion, need discern them, must write which content so that know.Before the arbitrary Audit Report of operation, also need they are discerned, lose from the source so that find module easily, or whether this module is the built-in module that is provided by origin system.
In this other project that need discern is system's constant and variable.For example, some global variable-USERID are provided is exactly an example to most of language.It can use anywhere, but the programmer never needs they are stated.This is owing to they are in the system of being solidificated in, and is the same with regard to transform.The example of global constant is the speech SPACES among the COBOL.Explanation again need be discerned and understands these projects, so that the knowledge how record is changed them.
In case all built-in functions, variable and constant have been carried out identification 44, just they need be inserted in the knowledge base.Usually, this is the module that has the title (for example LINC GLOBALS) of this system by establishment, and all functions, variable and constant is attached to this module carries out.Then, when the random procedure in this system is handled, at first this global module is loaded into action scope (scope), thereby makes this program can obtain all variablees, function and constant.
Need obtain all factors relevant, and import 46 in knowledge base with input system.The information of obtaining comprises:
The compiler option;
(rounding) option rounds off;
Word length;
Choice of language and
The code number of pages.
In this stage, need the action scope of project in the understanding language how to work.Consider the difference between the following language:
In language 1, program has a screen, in fact in program all variablees that illustrate on the screen is stated, and is just allowed this screen to use this variable.So, a definition of variable X is only arranged.When the refresh routine variable X, the screen variable of X is also upgraded automatically.
In language 2, screen is independent of program and defines, and screen comprises they self variable.When program decision comprises screen, thus then the programmer must state employed all variablees of this screen-, have two statements to variable X.In this case, the program variable with title X matches with the screen variable with title X.
Language 3 may be similar with language 2, but the programmer need not state in program that screen variable-system postulation is this situation.
But language 4 also is independent of program variable with language 2 similar-screen variablees.When whenever quoting the screen variable, this screen variable is called Screen.X, program variable X only is called X.
For correct all these different situations of handling, create the action scope loader (Scope Loader) 48 of various language.Be action scope loader appointed language rule, to solve such problem, for example " we have variable X, and what we spoke of is screen variable or program variable " and " this program is not stated variable X, but has used variable X in code, how this does? "(whether we need client is said " definition that we do not have X " in order to generate Audit Report, or defining variable X in should being attached to other content of this program only?) and for code is carried out transcode, the understanding language rule, and correctly to obtain these action scope loaders all be necessary.
Assemble knowledge base about this problem, thereby might discern the project that all are lost.Audit Report breaks away from knowledge base fully and moves 50-so all information are loaded into Audit Report is very important.
At first, operation is called the process of quoting resolver.This process is searched all references to project, and attempts to find the project of discussing.Noting quoting resolver uses the action scope loader at source language to carry out this process.Can carry out this process if quote resolver, then these two projects be linked.Can't carry out this process if quote resolver, then may be a kind of owing in following three kinds of reasons:
This project is built-in function, variable or the constant (referring to step 48) in the origin system that also is not identified;
Figure S2006800232036D00152
For some reason, one in our the previous process does not work---and possible program is not resolved, or the tree of creating is nonstandard, so delver can't normally be finished their task, or (if set up test, test result show be not this reason);
Figure S2006800232036D00153
Client does not also provide relevant source.
Next, dispose 52 metadata.In this stage, know how to change this system roughly.Write out some conversion constituent elements, have some also wait to write out-but in this stage, need decision to use which constituent element, and will determine the constituent element of use to drag together.
Simple engineering information is stored in converting attribute (transformation.properties) file of this project.Out of Memory is stored in the control program that is used for disposing-this control program storage and for example moves which tree walker, uses which action scope loader, uses the information of which statement register (DeclarationWriter) etc.
Then, write out 54 all " built-in " constituent element-frameworks (framework) that need with output language.If input system has the built-in function of expression " write down this variable, take advantage of with 100, and shown in red ", then in output code, create the function of finishing identical thing.Usually, in input system, have the function of any number between 15 and 40.Some are simple functions, format as data.Other complexity is noted the control of database access or screen.
A series of processes 56 of English name are obtained and generated to the project that is implemented as all statements.This step comprises:
Figure S2006800232036D00161
Domain analysis;
Figure S2006800232036D00162
Abb. expands and conversion;
Figure S2006800232036D00163
Note is analyzed;
Figure S2006800232036D00164
File analysis; And
Figure S2006800232036D00165
Contextual analysis.
With regard to implication and accuracy candidate's title is weighed.Allow to use the agency, thereby make client can influence the generation of title.This is the process of an iteration, to guarantee to adopt most probable title.
Next, write out BSD conversion 58 for built-in function.Because the standard English that generates for BSD is detailed inadequately, so built-in function that can not handling procedure.For example, the standard B SD of function generates and may be expressed as: " calling built-in function Determine Next Row ", its operation parameter CLIENT, DATE, CLIENTID are called.This statement is descriptive strong not as " reading and recording from the table CLIENT with main key word DATE and CLIENTID ".Because built-in function is often used,, include very high degree of intelligence so give them given extremely concrete conversion usually.
Ideally, when being converted to a kind of new language, can use the data type of in this language, solidifying.Yet in different language, variable can not show as identical mode.With the decimal number is example.If multiply by 7.266 with 3.141, system is stored as 22.822506 with the result, still be stored as 22.822, perhaps be stored as 22.823? because the performance of each system is different, therefore one of first thing must doing is exactly to create with the data class (data class) of input system to show identical data class.
In case concrete variable is analyzed, just be we can say " at any time, only give this variable distributed 1 to 10 integer---it will show as identical mode in bilingual ".In this case, this variable can be converted to standard data type 60 in the output language.Yet this must carry out at variable according to variable base (variable basis).In some cases, may can't know already used forever is any value, so always need to use the data class of imitation input system.
Next, write out correct emulation screen/needed framework 62 of report/routine call.When establishment that Here it is shows identical framework with input language.For example, input language be session also be non-session? this needs framework to go to finish.Have some programs initiated to operate in the asynchronous task in the background? this also needs framework to go to finish.What can take place if this system shuts down in issued transaction? this still needs framework to go correct processing.
Be created to the conversion module 64 of output language then for input language.These templates help identification to need which type of tree walker, and from which claim information of input system must be delivered in the new system.Be not always to create conversion module, but they have great help to the analysis of language.
Basically in the framework team someone obtains several small routines from input language, and they manually are converted to output language, and when guaranteeing that they can be worked, drawing template establishment.Usually, they will select such program:
Figure S2006800232036D00171
Access screen
Figure S2006800232036D00172
The accessing database table
Figure S2006800232036D00173
Handle all duplicate records (rolling form etc.) on the screen.
In case created template, then change team and just can better understand and how code is changed, and find potential problems in the transfer process as early as possible.
Write out the tree walker 66 that need be used for transcode.Will pay a large amount of time and efforts at this changes.Some can be created the public walker that all language carry out standard handovers.Yet conversion needs quite specific conversion mostly, therefore needs specific (language-specific) tree walker of language.
For all engineerings, under new environment, move the conversion that existence must be carried out in order to make code.In addition, more succinct in order to make code, or object-oriented etc. more, can carry out some raisings.Further detailed description will be carried out to tree walker in the back.
Next, change the title 68 of all statement projects.All programs, variable, file etc. all need to export title.For BSD, converting system is used the English name (EnglishName) that generates, other conversions for all, and this system uses target designation (TargetName).
Use a plurality of processes to determine how to generate target designation.Even after creating legal name, also, meet the naming standard and the demand of output language so that guarantee the title of all uses at these title operation title scourers (Name Scrubber).For example, java does not allow to occur dash "-" in the title of method or class.
Use the algorithm of homophone, synonym and uniqueness then, to guarantee correctly to generate candidate's title with output language.
In above discussion, mentioned the conversion and control program, but up to all tree walkers are all discerned and handled, control program could finish.This is by setting up of conversion and control program finished 70.These control programs comprise the title of each tree walker to be moved, action scope loader to be used, data type assistant (DataTyperHelper) to be used, statement register (DecalarationWriter) to be used and logical record device (Logic Writer) to be used.
New variable declarations 72 can be written to their file (or class) or write in the file identical with program, screen or report logic.Variable declarations is used data type assistant (DataTypeHelper), how different data types is changed and is stated so that know.
Next, create screen XML file 74 for output language.The operation process is so that generate the XML file that comprises about the information of all screen variablees.This information is used for shining upon between screen and program.Write out the screen creator for every kind of different input language then.
Create DB table class 76 then at output language.Usually, each database all has their output file.Yet this process be quite standardized-, have at this and to be different from that construction method needs to create in input system a plurality of.So to the great majority conversion, the statement of form and their row is public, yet about these forms, the statement meeting of obtainable method changes at each input system.
Next, establishment is at the files classes 78 of output language.File, as database table, statement be quite standardized, but may need to increase the method for input language specific (input-language-specific).
Establishment is at the class 80 of any repetition screen form (Repeating Screen Table) of output language.If used the BSD configuration, however do not need this step-, for the system of any operation, need these classes clearly.Unless repeat the rotatable son file that screen form-be known as shows-be difficult to change on screen.Every kind of input language all has the different modes that defines and handle these projects.Each row is checked and handled to some language clearly; In other Languages, each provisional capital is handled by system in the dark.Current, create class and mate these duplicate records, be extremely specific for input language.
Create report 82 then, these reports comprise the report XML data of output language and the reporting format of output language.
Next, write out the needed claim information 84 of output language.Program is divided into two parts: but claim information and actuating logic.Claim information is stored in the knowledge base, and executable code is stored in the tree format (as the BLOB in the knowledge base).Use knowledge base information to write out claim information, and write out in the mode of output language expectation for each procedures/modules.
Every kind of input language has different built-in functions and different system variable etc., therefore, when writing out output language, essentially inherits different basic classes.Thus, on the top of each written-out program, each input language needs different statements.
Generation is at the programmed logic 86 of output language.The easiest part that this normally changes.Tree walker has turned to code module the manageable content of output language resolver.Configurator is just gone down tree, and writes out that it sees.
Next, generate BSD tree 88.Generate the BSD tree (BSD Navigation tree) of cruising according to remaining on claim data (DeclarationData) in the knowledge base.This process can be based on the knowledge base of COBOL style and is moved.
Have all information that need in the code by the generation of BSD resolver, but not format.The final step of BSD process is the code of all generations of scrutiny, and it is arranged as the code 90 that can check in the web browser.
Next, generate the version 92 of the HTMLization of all input codes, include BSD.Process only with all text codes as input, and they are shown as the HTML screen.
At last, repeating step 38 to 90 is up to realizing switch target.
Transform engine shown in Fig. 3 comprises a plurality of processes of using special software tools.For whole conversion process, can think that these instruments or constituent element are general, they are realized the conversion of application program by specific process transfer.
To describe standard tree in detail now.
At first, the tree construction storage is about the information of application program.Must discern and define each constituent element of language.By each constituent element is reduced to its basic meaning, the present invention can increase the sentence structure difference in the language, and each language is become general form.
On standard tree, record two kinds of complete different kinds of information:
The claim information that comprises all projects of being named (for example circulation of program, variable, function, name, paragraph etc.), and this project all properties (length, action scope, observability, English name, description etc.) that may have.
Each possible attribute to projects defines, so standard delver process can retrieve all relevant information, and is stored in the knowledge base.
Figure S2006800232036D00202
Logic comprises the actual statement of the executable section of composition program.Each statement type is discerned, and with the structure mapping of statement in tree.The required information that has been the structure of statement node and node type and node text entry.For example, with reference to figure 4, the condition node with the node text (Node-text) of " IF " is always arranged under the IF statement node.Can also have action node (Action node) alternatively, and have action node alternatively with the node text of " ELSE " with the node text of " IF ".
Node structure
Each node has following attribute.
Figure S2006800232036D00203
Node type (Node Type)
This attribute shows that this node is IF statement (IF_STMT) node, or variable declarations (VARIABLE_DECLARATION) node etc.The structure of node type Control Node itself.For example, all nodes with type of IF_STMT must meet above shown structure.
Figure S2006800232036D00211
Node text (Node Text)
The node text storage has second information of articulation point.
Sometimes the node text serves as subtype---and for example, ACTION can be " IF " action, or " ELSE " action etc.
Other the time, the node text serves as the link of source language.For example, in language LINC, IF_STMT is encoded to
“Do?When?x=10
...Code...
End”
In this case, the IF_STMT node has the text of " Do When ".
Row number (Line Number)
This is the row number from the source language of input.It can be used for tree construction is related to the input source language backward, particularly uses when debugging.
For the purpose of encoding, each node is the example of the standard nodes developed for the present invention.This standard nodes class comprises all properties listed above, and increase identifies (Parent ID), son sign (Child ID) etc. with this node link to the needed attribute of tree-father.
In addition, the standard nodes class includes the method that helps set traversal and configuration process.The explained later standard nodes.
Standard nodes (Standard Node)
Standard nodes is the title that is used to imitate the class of each node on the standard tree (Standard Tree).It comprises:
Figure S2006800232036D00213
Have several attributes about the information of specific node;
Figure S2006800232036D00214
With this node link several attributes of tram in the tree;
Figure S2006800232036D00215
Be used to several methods of obtaining the information relevant or this node being operated with this node.
Standard nodes comprises following attribute:
The IF STMT of node type-for example;
Figure S2006800232036D00222
Row number (being meant row) from the input source code;
Figure S2006800232036D00223
Sign-it can be by the tree walker setting, to represent and must make amendment to this node;
Figure S2006800232036D00224
The sign (ID) and
Parent ID, Child ID, left brotgher of node sign (Left Sibling ID) and right brotgher of node sign (Right Sibling ID) are so that with the position of this node link in set.Standard nodes comprises method-be that each node knows how to carry out following processing---for example:
Figure S2006800232036D00226
Obtain next brother;
Figure S2006800232036D00227
Obtain the father;
Figure S2006800232036D00228
Obtain first son;
Figure S2006800232036D00229
Use specific type or text or both, search first child node;
Use specific type or text or both, search first father node;
Figure S2006800232036D002211
Use all-links to make the copy of self;
Use all links (lower link) downwards to make the copy of self;
Figure S2006800232036D002213
From tree, remove self;
Figure S2006800232036D002214
Use another to replace in the tree self;
Increase new son or fraternal standard nodes;
Increase new son or brotgher of node QS, and to new standard nodes transmission control;
Figure S2006800232036D002217
Search the son or the brotgher of node of the first non-note.
When creating transition tree walker or tree delver, almost generally use these methods.
Its node structure that each node type has plenty of admittedly.For example, the IF_STMT structure is its (CONDITION) node of must having ready conditions, and can have two actions (ACTION) node alternatively.Store this node structure with the form of text.The knowledge that is this structure makes this system to operate node, and tree is traveled through.
May expand standard nodes, make it have the node class specific each node type.This is variation (Variable) node, and for example, storage is only to the variable information specific, and comprises the method that only variable is suitable for.In this case, the variable node type can be known the acceptable structure of variable.
And, may expand standard nodes, thereby can append to this node with more changing (Transformation) information---for example " this may be the candidate of copy (deduplication) ", or " this method is quoted from three positions ", etc.
To an example based on the code process standard tree be described now.
Most of resolvers only are identified in speech and the symbol that uses in the language, and they are put into tree format---syntax tree.When generating this tree, these resolvers do not use any intelligence---and they are only exported, and they see.
On the other hand, resolver of the present invention has embedded some intelligence to this resolver when setting up tree.Resolver of the present invention can identifiable language speech and symbol, can also carry out following processing: with these symbol transition is standard definition, identify project that position role in language, and create extra element in the tree, so that the symbolically notion.
For the above processing of resolver is described, consider the example of following C code snippet, and relatively can be according to two trees of this code establishing: syntax tree that generates by the C resolver of free acquisition and the standard tree of creating by resolver of the present invention.
Var1+=abc.varX*2;
calculate(var1);
Fig. 5 shows the syntax tree of being set up by the standard C resolver.Subtree to first statement has been carried out abundant expansion.And the subtree of second statement is not expanded.
About this tree, note following several:
Although two statements are very different statements, all start from identical node nSatementExpr.
The symbol that occurred in the C code is according to according to former state-for example STAR and DOT.
In fact do not represent and so on hint about these symbols.
Unless you know this tree representation c program a., and b. you understand the C language, otherwise the structure of this tree is insignificant basically.
By relatively, resolver of the present invention is created the standard tree that each constituent element to language identifies and explains, and no matter the source language of input is C or RPG or other, the subtree of this standard tree all has identical form.
In order to create such standard tree, resolver must have the knowledge of each constituent element of input language.Fig. 6 illustrates the first step of this processing based on sample C code.
Next, the people who creates this resolver is mapped as the standard tree form with these statements, to determine create for each constituent element the subtree of what type.This form is a standard for all language, thereby itself and source language are expressed as at first:
Var+=abc.varX*2
Still
Add (2*varX of abc) to Var1 has nothing to do.In case this language is mapped to the standard tree form, the people who is then writing resolver just guarantees that the required tree of the tree of creating and standard tree is complementary.The standard tree that obtains as shown in Figure 7.
At this moment, can use this standard tree in many ways.
Owing to all constituent elements are named, therefore are easy to realize analyzing.For example, must search all positions that variable is provided with usually in code.This can realize by search all variable nodes that occur under destination node (Target node).
Be easy to realize strengthening.By repeatedly traveling through standard tree, in knowledge base, and the information in the retrieval knowledge storehouse can be added information on the tree to information stores, or mobile message in the tree.For example, can be with extra information, for example type of variables or variable-length, be increased on the variable node-these information are the information that is stored in the knowledge base.
Also be easy to be implemented to the configuration of another kind of language.Each language configurator is known as its target language how and is write out assignment statement.
Knowledge base (Repository)
The purpose of knowledge base is:
Figure S2006800232036D00241
Obtain all statement elements of application program;
Figure S2006800232036D00242
Store all executable codes and have the statement project of these executable codes;
Figure S2006800232036D00243
Store the relation between the different statement projects;
Figure S2006800232036D00251
The analysis of activation data;
Figure S2006800232036D00252
Stylus point is to the metadata of engineering.
For this purpose, in knowledge base, store three types information:
(i) claim data (Declarative Data);
(ii) analyze data (Analytical Data) and
(iii) metadata (Metadata).
(i) claim data
The statement project can be program or variable or screen etc.All claim data can have the executable code related with it (to the setup code of variable; The code that legalizes to screen; Logic at program), and in application program, all the elements all must have in other with some certain get in touch-for example, program may have variable, and program may be quoted another program.
All statement projects are known as object.They all are stored in the database table that is called Object node (Object Node).Some content is that all statement projects are common, for example title and type.For all statement projects be public content stores in the Object node form, that is: input title (InputName), target designation (Target Name), English Name (English name) etc.But all actuating logics that are attached to this project all are stored in this form as syntax tree.
Because most of language allow to exist a plurality of projects (for example, if they are in different storehouses or path) of same names, so all forms, comprise the Object node form, all identify by Object node sign (ObjectNodeId).
Object node must be several a kind of in dissimilar, and this several types comprises: module (program, function, method, paragraph etc.), variable, screen, file, form, report etc.Relevant with the special object node type all details---for example, argument table has been stored input data type (Input Data Type) and target data type (Target Data Type) in storage in these tables.
Relation between the different Object nodes is represented by Object node relation table (ONR).The ONR table has been stored all cross references and their type.For example, is this relation a still adduction relationship (these two objects can exist under the non-existent situation of the other side, but can quote mutually) of owner (OWNER) relation (do not having under owner's the situation, what had is non-existent to liking)?
Knowledge base is designed to write down all properties of arbitrary statement project.Yet usually in new language, some is not fully understood or is seemed incoherent attribute.These attributes still will record, but because they do not meet our any one standard attribute, so there are not to store their row.In this case, with these information stores in being attached to the extra details table (ExtraDetails table) of destination node table (ObjectNode table).This extra details table is the Id that quotes of storage key, details and destination node only.
Can obtain multiple view about database,, and make the transition between old-fashioned database and this database become easy so that extract the information that needs usually easily.For example, middlebrow demand is all methods of searching in the application program.In order from table, to select these information, need between destination node and the module relevant so that search program module (Program Module); Need need then to turn back to the related of destination node and module, so that find the method module from program module to the association of quoting from program module.By single viewpoint, program technic substitutes for this.
Analyze data (Analytical Data)
Analysis form (analytical table) is used to write down the information about how to use object and where use object.The analysis data of being stored comprise to be quoted---program A calling program X, and program A uses form Z.
These forms can be used for writing down more analysis information, so that use of correct analysis variable, data type, code copy etc.This analytical information comprises:
Figure S2006800232036D00261
Variable uses or wherein by assignment;
Figure S2006800232036D00262
When occur not by the variable to be audited of assignment;
Figure S2006800232036D00263
Quoting which kind of is dissimilar is passed to program/function;
Figure S2006800232036D00264
Wherein form is upgraded/reads and
Figure S2006800232036D00265
Wherein file is upgraded/reads.
(ii) metadata
Now, two metadata tables are arranged in the knowledge base:
Data type conversion table (Data Type Translation table) is at all language, and storage is about the information of all data types.Which object repertory (InScopeItem table) control handles by which task in the action scope.Metadata can write down all information of the process that can drive in the metadata.
Message reference and modification (Information Access and Modification)
Following instrument has used unique structure of information stores constituent element.
To knowledge base conduct interviews (Accessing the Repository)
Two kinds of methods that the visit knowledge base clearly, is arranged: artificial or sequencing.
Artificial visit knowledge base in fact only is suitable for realizing selecting, or is used to realize simple Data Update.The use of the standardization of database and the automatic ID that generates means very difficult by artificial SQL statement insertion information in database table.
In database, created a large amount of views, thereby made artificial enquiry be easy to management.
Sequencing accessing database is easy to.When using the class accessing database, importantly understand the relation between class and the database table.
Each table in the database is represented by class.How automatically each class knows preservation/renewal/deletion self, and how to handle any erroneous results.The programmer in each class, provides method, so that can easily represent " this variable is had by that program " etc.
Yet, also more than these, each class can be controlled a plurality of forms.The knowledge base class hierarchy is shown among Fig. 8, and wherein database table is less frame, and class is bigger frame.Module class not only can the control module form, can also the controlling object node table.This is for all statement projects: form, variable, screen, module, file, record all are correct.Each class of representing these projects can be controlled the visit to Object node table, extra details table and description list.In addition, variable class (Variable class) can also be controlled the visit to corrector table (Modifier table) and matrix dimensionality table (ArrayDimension table).A single method in the variable class can upgrade/insert/delete the row in these tables.
Knowledge base DAO (DAO, RepositoryData Access Object) class is compressed a large amount of general SQL, and can be obtained and use by the programmer.Usually, these SQL are following form:
All row (Retrieve/insert/update/delete all rows) of retrieval/insertion/renewal/deletion
Retrieval/insertion/renewal/deletion has the row (Retrieve/insert/update/deletethe row with a specific ID) of specific ID
Retrieval/insertion/renewal/deletion has the row (Retrieve/insert/update/delete all rows with a specific InputName) of specific input title.
Tree walker
" tree walker " be to the traversal standard tree and implement this tree of the task of appointment-change in some way usually-the adopted name of one group of process.Tree walker for individual task be extremely specific-for example, a tree walker can be resolved the GOTO statement, another tree walker can limit name variable, etc.
Tree walker can be written as following any:
Figure S2006800232036D00284
To input language is specific, works on the tree that the input language characteristic is arranged;
To input language is specific, on universal tree, work or
Figure S2006800232036D00286
General.
For arbitrary conversion, often need from all three types of tree walker, select.
Although being for they, the fact acts on different trees,, each tree walker is structurally basic identical.Each tree walker has been expanded one and has been called the class of walker, and has the basic skills that is called traversal (walk).Tree walker itself is not a master routine, but by another routine call, this program will be treated to pass to tree walker by the tree of tree walker conversion.
Each tree walker recurrence is passed through tree construction downwards, checks each node simultaneously, up to finding an interested node.When tree walker is found interested node, just carry out necessary operation at this specific node at once, and move on.Each tree walker can be to the tree after calling program returns new conversion.
Can as required tree walker be write as specific or general.The task that they can be finished is little of the title that changes function, resequences fully to the part to node greatly, or creates new node.
Each node on the tree is the example of standard nodes, and each node can be the root of another subtree.A kind of with in following four kinds of modes of tree walker, cruise in the tree and carry out necessary modifications:
By using obtainable method-standard nodes on arbitrary standard nodes;
Figure S2006800232036D00292
Knowledge according to the scrambler of the inherent structure of particular sections vertex type;
Figure S2006800232036D00293
By using node assistant (Node Helper), this node assistant knows the definite structure of particular sections vertex type, and is provided for the useful method of the information of obtaining and this structure of conversion; Or
Figure S2006800232036D00294
Increase functional any one search and search method by using to standard nodes.
This standard nodes class provides some standard methods, uses for tree walker.This standard nodes comprises cruises tree walker and modification, establishment or deletes new node and all methods that subtree is required.For all different node types, these methods are standards.
The problem of bringing thus is, although each node has several different methods, they are extremely general.There is not standard nodes to know his sub-tree structure should look like anything.For example, each single node type as mentioned above has specific structure.The universal nodes class is not known the structure of particular type, and therefore the method based on this structure can't be provided.For example, general class can not known: if node type is IF_STMT, being expected at so has 1 condition (CONDITION) node and optional two actions (ACTION) node under this node.Tree walker has overcome this problem-or by being tree walker with this structured coding with a kind of in the following dual mode, or uses Helper.
If the people of code tree walker knows the structure of given arbitrarily node type, then they can correspondingly encode.Tree walker has been written as concrete node structure has been expected mostly.
Yet node is known the structure of self and has concrete node type institute specific method to be useful sometimes.For example, in calling module statement (InvokeModuleExpression) (unless being known as function call), tree walker may want to obtain the tabulation of all parameters, or the number of parameter is counted, etc.These methods are specific to calling that module table states, so also do not realize in standard nodes.
Assistant's notion is that it provides specific node, and provides all essential methods of this node of conversion.Assistant's node knows definitely what the structure of specific node must look like.At this moment, tree walker must be known node types, so that determine to call which assistant.Replacedly, assistant manufacturer (Helper Factory) will be conceived to arbitrary node, and the tree walker that has correct assistant is provided.
In addition, having defined extra tree cruises and search class.These can use in more specific conversion, and for example OS2 C is to the conversion of WindowsC.
Tree walker had both used the assistant, also used the standard method that can obtain in the standard nodes class, mobile data in the tree, and this structure and content made amendment.In addition, they can be at the extraneous information of project about name, search knowledge base.
If resolver can not the creating a standard tree format, or illustrates the needed information of delver if desired, tree walker only is applied to input and handles so.In general, at input side, preferably can keep code similar as much as possible to its input language.
In the conversion side is all other tree walker-enhancing walker and conversion walkers.
Below be the tabulation of existing tree walker, and their simple descriptions of working:
Common_Goto_ExitName_Walker Search only advances to all GOTO statements of the exit point (exit-point) of module, and these statements are transformed to RETURN_STMT.
Common_ModuleComment_Walker Search is located immediately at all the note pieces before the module statement.Suppose that these notes are actually and describe this module, so equally they are attached to this module
Common_PromoteIMEName_Walker Extract calling module statement (InvokeModuleExpression) node (IME), and check their title according to the tabulation that provides.If this IME title in tabulation, then increases to designated parameters the part of title.This has changed IME from the form aspect effectively, for example: change into myFile.write (" hello ") from write (myFile, " hello ")
CommonGOTOWalkers Try to resolve the GOTO statement in any kind of mode
Common_ModuleOutOfScope_Walker All of searching the program in action scope are not called, and use and call frame method and replace them, and mistake is charged to daily record.This uses in the Java conversion, so if code tries to call the not program in action scope, then mistake is charged to daily record.
Common_RemoveMainAction_Walker A lot of input languages are not attached to " main " generation in the program
Sign indicating number one is opposite, and all codes are included in the method.This is the typical case of 4GL, and the 4GL application program knows at first call which method inherently, so do not carry out actual calling in code.This walker is searched empty program behavior (Program Action), and deletes them.
Common_ReverseQualifiedName_Walker Qualified title is the speech that provides the B that concerns A.B or A.The owner that it is second NAME node that the structure of qualified title (QUALIFIED_NAME) node needs first NAME node.Yet this is not easy to realize in resolving sometimes.So, in the process of resolving input language, when qualified title node chaotic ground occurs, use this walker.
Common_SelfAssignment_Walker This is to increase the type walker.It searches all examples of mathematical equation, wherein also (for example, uses TARGET in X=X+1), and they are transformed to the form of X+=1 in this calculating.Can use in any language.
Other walker can be specific to input language.
In some instances, developed the tree walker that node is simplified.For example, have two row, triplex row or the group of multirow code more of frequent execution, in fact these codes should be converted into function or be converted to dissimilar statements.
This tree walker is extremely specific for language.Replacedly, walker can be written as: extract the tabulation of code pattern and the tabulation of replacing code pattern, and carry out the conversion of these types automatically.
Below be the simple description that strengthens walker:
Boolean Variable Check (Boolean variable inspection) When input language does not have Boolean data type, the condition of expression as ' IF X=" TRUE " ' is arranged usually in code.It can be revised as: making X is Boolean type, and will relatively be converted to the expression of " if X ".This tree walker need use by variable usage mining device (Variable Usage Miner) and variate-value delver (Variable Value Miner)
The information of collecting.
Common Code Pattern Replacement (replacement of normal codes pattern) When being given as input code pattern (Code Pattern) and replacing code pattern, all examples of tree walker searching code pattern, and replace.Code pattern is accepted with the form of standard tree.
Code De-duplication (code removes copy) Tree walker can be used for two sections whether identical, similar or fundamental differences of cognizance code.Usually, this inspection is excited by concrete data items: " when you find renewal to this form, write down, and relatively whether it being identical with all other renewals of same form ".This tree walker need temporarily be preserved the copy of subtree in certain position of knowledge base.
Variable Scope Changing (scope of a variable change) Now, when being transformed into java, the position of in input language all variablees being stated is in the program action scope they to be stated.Yet this must not carry out in Java.In case realize variable usage mining device and variate-value delver, we just can identify the action scope of variable, thereby use tree walker that the definition of variable is moved to more suitably position.
Variable Data Type Changing (data type of a variable change) In case we know where used variable definitely, how to use, we just can determine whether and can realize this variable with basic data type in output language.For example, may only once be composed the cycle counter of 1 to 10 value, in Java, be embodied as Int---but it is in office what when this variable is used in its place never to have only us to determine, is endowed 3.141592 value never.
Change static references to non static (quote change into non-static state with static state) When the program of implementation procedure in Java, they use some static methods.
Tree operations instrument (Tree Manipulation Tools)
Store all executable codes with tree format.In order to operate these codes, and, be a plurality of ad hoc approach that are used to assist below with the output of these code conversions for expectation.
(i) node assistant: the node assistant is the class of matched node type, knows the structure of node, and comprises a lot of useful method that are used to use and change this node.When they had preserved the knowledge of structure of this node in a place, node the assistant be particularly useful, so may easily realize the conversion to this node structure.
Node assistant's example is:
Figure S2006800232036D00331
NodeHelperIME
Figure S2006800232036D00332
NodeHelperVARIABLE_DEFINITION
Figure S2006800232036D00333
NodeHelperPARAMTERS
NodeHelperMULTIPLE_DEFINITION
(ii) node is walked device (Node Traverser): it is the simple class of advancing in the tree with ad hoc fashion that node is walked device---or from place that they begin up or down, or at first advance to the degree of depth, or at first advance to the brotgher of node.Usually these walk device in self-contained visitor (Visitor) class.Imagine by this way: this walks device is to walk the motorbus that particular course is passed tree.At each node, motorbus stops, and the visitor gets off, and has finished some tasks that he should finish, and gets back on the motorbus then, and advances to next node.
These examples of walking device are:
Figure S2006800232036D00335
The offspring walks device (DesendantTraverser)
Figure S2006800232036D00336
Ancestors walk device (AncestorTraverser)
Figure S2006800232036D00337
Tree is walked device (TreeTraverser)
Figure S2006800232036D00338
The brother walks device (SiblingTraverser)
(iii) aforesaid visitor, visitor are the classes that has task to finish.They are carrying in the tree and are advancing by walking device, and finish their task at each node.Usually the visitor only checks each node, see this node whether be its institute interested that.If then finish all tasks that require them to finish when they are encoded.Otherwise the visitor only moves on.The visitor can be created as and search first (FindFirst) visitor, in case finish its task, motorbus is stopped; Search (FindAll) visitor entirely, it can all the way move forward to the end of circuit.
(iv) filtrator (Filter): filtrator is to check whether this node is the class of interested node.Usually,, can be the given filtrator of this visitor,, otherwise return False if this node should check that then this filtrator returns True when the visitor being sent when walking on the device.
There is following filtrator:
Figure S2006800232036D00341
Type filter (TypeFilter): only be apprised of the node type of search, check node type at it.
Type text filter (TypeTextFilter): be apprised of the node type of search and the text of node at it, check the text of node types and node.
(v) set delver (Tree Miner): in case input text is resolved to the standard tree form, just can be from this standard tree retrieving information, and be saved in the knowledge base.The process of carrying out this processing is called delver.
In knowledge base, stored three types data:
Figure S2006800232036D00343
Claim information (Declarative Information)
Analytical information (Analytical Information)
Figure S2006800232036D00345
Metadata.
Metadata manually is inserted in the database.
The definition of any content that claim information is named basically.This content can be variable, program, method, screen etc.
The analysis data are the details about the use of arbitrary object.
By delver, claim data and analysis data all are loaded into knowledge base.
Delver is only to pass through tree construction basically repeatedly downwards, up to the program that finds interested node-for example, and variable-definition (VariableDefinition).In case delver finds interested node, just try one's best to get all information (delver is known the structure of interested node usually), and this information is saved in the database about this node.The program of control delver can guarantee that project is inserted into the tram in the action scope.That is to say that if stated variable in the method in program, then in database, this variable is had by this method, this method is had by this program again.
In general, in case excavated information, then this information is deleted from this tree from declaration node.This is because both definition of stored items in the tree when storing the definition of this project again in database, can cause problem.Definition on the tree is in case excavated, and just from setting deletion, and the definition that is stored in the knowledge base is through modification and the definition through changing.
If this project then is stored in this executable code in the knowledge base with this project with tree format with any executable code (for example, the existing claim information of program and method has executable code again).
In case input language is resolved to standard tree, then can excavate to it.All program resolver (ProgramParsexxxx) classes all can be called key cut class (suitably called after delver), so that the program of up-to-date parsing is saved in the database.But delver can be statement part and its operating part with this procedure division, but this operating part is attached to correct statement part, and they all are saved in knowledge base.This means that the whole input tree of being made up of declaration node and logic node is divided into a plurality of Object nodes (ObjectNode) (one of each program in the database, one of each method), each Object node all has the logic tree of himself, as shown in Figure 9.
Below be the description of dissimilar delvers:
Miner Extract all module statements
The module that is called delver (CalledModuleMiner) Find all to call, these are called to be loaded into quote in the form (Reference table) function, program, method etc.If invoked method is local to program, then it resolves this at once and quotes.
Screen delver (ScreenMiner) Search all screens, execution, record and the statement of screen territory
Variable delver (VariableMiner) Search all variable declarations
Variable usage mining device (VariableUsageMiner) Determine where to use variable---assignment and quoting
Table access delver (TableAccessMiner) Where determine pro forma interview sheet---upgrade, insert, deletion
Parameter delver (ParameterMiner) The details of employed all parameters when extracting calling module
Configurator (Deployer)
Current, configuration process comprises conversion and configuration.
Each target language has the several separate configurator:
Variable configurator (variable deployer)
Figure S2006800232036D00352
The logic configuration device
Figure S2006800232036D00353
The form configurator
Figure S2006800232036D00361
The screen configurator
Figure S2006800232036D00362
The report configurator
Figure S2006800232036D00363
Program statement configurator
Variable configurator, form configurator and the non-fully information that is stored in the knowledge base of removing of program statement configurator.They are written into all items that project and this project had to be configured, and write out the statement of these projects with target language.Depend on the initial input language, each in these processes has standard process and different slightly processes.
In general, according to the template of when beginning, being created these processes are encoded near each conversion engineering.
Screen configurator and report configurator are also got rid of knowledge base.Yet, owing to do not generate the general process of these configurators at present, so their form is not a standard.
All application configuration all are known as the program of allocation engine (DeployEngine) and move.This allocation engine carries out following processing:
Figure S2006800232036D00364
From knowledge base, read the claim information of each program module;
Figure S2006800232036D00365
Create the new file of each program module;
Figure S2006800232036D00366
Be written into the action scope (promptly obtaining all variablees that this module may use, function etc.) of this module;
Figure S2006800232036D00367
Call statement writing device and write out statement;
Obtain the logic tree that is attached to this module;
Figure S2006800232036D00369
Tree is used arbitrary tree walker;
Figure S2006800232036D003610
Calling logic writing device writes out the executable code of this program module; And
Figure S2006800232036D003611
Search all submodules (for example, all methods, function etc.) that are attached to this module, and repeat above processing at these submodules.
Programmed logic configurator exclusion standard tree.Use is called the too development application configuration device of ANTLR.The logic configuration device advances on the tree given to it, and each row of code writes out with meeting delegation in delegation.For example, when it arrived the IF_STMT node, java logic configuration device was known and is write out " if (" is condition then, is ") { " then, is action then, is " } then ".
Whenever the logic configuration device arrives the entity title, and it uses this title to search this entity in the action scope table, so that determine the target designation and the data type of this entity.The project goal title is used in this configuration usually, never uses its input title.This process is handled by the statement class---and to the java configuration, the statement class is the JavaExpression class.
Also there is the operational symbol class, therefore handles each operational symbol type.The logic configuration device knows how operational symbol influences the type of statement (for example explain several 1 will cause Boolean type less than several 2); And know how each statement handles each operational symbol (for example X=Y if X is the character string of regular length, then writes X.set (Y), if X is a character string, then writes X=Y).
Programming controller
Allocation engine itself is controlled by Engineering Control device class.If this project is that CSP is converted to Java, then can exist to be called the class of CSP to the configurator (CSPtoJavaDeployer) of Java.Such has comprised the tabulation of the tree walker of needs operations, the type of the type of the statement writing device that need use and action scope loader to be used etc.
Strengthen
The enhancing stage comprises that the code of important robotization resets meter.At input phase, obtained the obtainable information constituent element of each in the input code, and followed the tracks of various execution routes and the invalid code that is used for determining execution sequence about all operations and variable.
Reconstruction realizes in the enhancing process automatically.The feature of this reconstruction depends on targeted environment.If target is OO, rebuild the execution that just is designed to promote multi-level OO design (multi-tiered OOdesign) so.This needs large-scale scope of a variable analysis.If target is the structurized language of COBOL for example, then promote structurized scheme.In this enhancing step some are treated to:
Figure S2006800232036D00371
Cycle analysis
Figure S2006800232036D00372
Mix the identification of upgrading, for example nested IF is to CA SE, and GOTO is to the PERFORM statement
Figure S2006800232036D00373
The deletion of residue GOTO statement
Figure S2006800232036D00374
The unit of work identification
Figure S2006800232036D00375
" English identification " (" Englishification ")
Constituent element identification
Figure S2006800232036D00381
Scope of a variable is analyzed
Figure S2006800232036D00382
Code copy is analyzed
Figure S2006800232036D00383
Process is removed copy
Extract data model
Figure S2006800232036D00385
Set up object module (if at object module) based on scheme
Figure S2006800232036D00386
Constituent element is converted to method, and composes object module
Figure S2006800232036D00387
Re-factor (if at object module) based on scheme
Figure S2006800232036D00388
Interface identification and analysis.
Enhancing is carried out as signature (tokenisation) automated session afterwards, because:
Figure S2006800232036D00389
Artificial execution is rebuild pay and make great efforts limits to some extent; And
Figure S2006800232036D003810
If there is not the mixing of following processing: resolve fully and signature, and the code of the removal grammer that is generated by our input processor when being input to the enhancing process, then the efficient removed of automatic code is very low.
Usually, the cyclometry complicacy that makes up bad program has been reduced about 80%.Target be make the code that is generated cyclometry complicacy (CC, cyclometric complexity) less than 5.0.Well-written COBOL code has the CC of 5-8, and this can't be significantly improved.On the other hand, the CC of the code of writing badly reaches 1000.If CC is very high, then be difficult to generate code.Usually, the code of writing badly has the CC that reaches 8-100, and this CC can be reduced between the 5-15.
In case code is analyzed and is strengthened, just carry out configuration process.In this process, each technology Function Mapping is arrived target language and structural function.This usually needs great extra reconstruction.Some aspects of this execution are determined by the complicacy of the required reconstruction of job analysis unit and various potential scheme.
Structural frame is as the part of output/configuration process, by from the metadata level map to code interface and functional.Purpose is to generate to have the form of target language and the code of platform.
Net result is each stage in process, aspect the compatibility and compliance of target architecture, with the code quality optimization.If do not have frequent analysis and reconstruction, then can not generate quality and maintainable " flexibly " structured schemes with expectation.
In more detailed degree, the crucial fact is not need to set up the basis of complete (traditional) independent language as conversion.
The example of enhancing process will be described now.
Code strengthens and conversion
In case source code is resolved to the standard tree form, just begins code is analyzed and changed.Because the knowledge of the form of tree walker, the analysis of code and conversion are normally carried out by tree walker, thereby can be searched for tree, search specific code pattern, then just as needed, all examples are changed.
Below be details (the Below-are-details-of-a-samploTransfor-matien-and-Enrichm ent-{ of the example of conversion and enhancement process pRocess:-)
In some ancient language, the branch statement of GOTO form is extremely general, through being usually used in forcing code to circulate again and again, up to satisfying some conditions.Such code is called the pseudo-circulation of Goto.The code that is used to finish this processing often is tediously long and not structurized, thus make to code read and safeguard very difficult.
Coded system is to use loop structure to carry out identical functions preferably.The structuring of this code is better, be easier to read and carry out, and allows further to analyze and objectification (objectification).
As the part of enhancing and conversion process, pseudo-circulation is discerned to all this Goto, and is replaced by real loop statement.
This process has two parts: the identification of candidate item and conversion.
In order to explain foregoing, consider the following example of false code shown in Figure 10.
The identification process may further comprise the steps:
1. begin the pseudo-round-robin identification of GOTO (a) from the GOTO statement;
2. check whether this GOTO statement refers to get back to the statement (b) that marks in the code;
3. if then be conceived to condition (c), and the identification control element.In these cases, control element is a variable i.
4. confirm that control element had carried out initialization (d) before the statement that marks, and
5. confirm between statement that marks and GOTO statement, control element have been carried out revising (e).
The if tree walker confirms that all above conditions all satisfy, and then can change.
Variation on some transition forms may take place, and this depends on the variation of the pseudo-circulation of GOTO itself.
For example, code can be exchanged into the FOR circulation, if:
Figure S2006800232036D00401
Code in (code 3) does not use control element, and;
Figure S2006800232036D00402
Code in (code 1) does not use control element.
Otherwise code can be converted to the While circulation of standard.At the purpose of this entity, our supposition can be used the FOR circulation.
In order to be the FOR circulation, can carry out following modification to standard tree with the pseudo-cyclic transformation of GOTO:
1. create the FOR cyclic node.
With the statement in (d) from setting taking-up, and be increased to new circulation and begin below (LoopStart) node.
With the statement of (e) from setting taking-up, and be increased to new circulation and increase below (LoopIncrement) node.
With (b) and the code (c) move to do action (Loop Action) node from tree.
With the statement of (c) from setting taking-up, be increased to below the new end condition (TerminationCondition).
6. the GOTO statement is removed from tree.
7. replace the statement (b) that marks with new FOR circulation.
After the conversion, code segment can read as shown in figure 11.
This system uses its tree construction, has substituted the foundation of complete independent language.This operates by all the elements being mapped to " standard nodes ".
For the process of establishment and configuration structure node in the tree walker technology, the part of six links is arranged, in transform engine, be linked under input, enhancing and the output process.
Fig. 3 illustrates in greater detail the transform engine process.This process is identified by the circle corresponding to the numbering of process list in the following table.Square shade numeral can be used under special state.
The square process that has dark shade is represented the process of the general constituent element that those uses describe below.These processes have realized the key element of conversion functional---input, enhancing and output.
This figure has listed the context of these special constituent element operations.The process that it had both shown crucial robotization also shows relevant artificial process, and these artificial processes are put in order the step of transform engine, thereby make application program be transformed into different technical stipulations from its existing technical stipulation.
Though artificial process is basic as the final purpose that realizes conversion application, and is very important in general cognition, the periphery of critical software process just is so that bring high automatization level for process.
It should be appreciated by those skilled in the art that under the situation that does not exceed the spirit and scope of the present invention of broadly describing, can carry out various variations and/or modification the present invention shown in the specific embodiment.So in all respects, present embodiment only is indicative, rather than determinate.
Nomenclature
Filtrator (Filter) Filtrator is to check whether concrete node is the class of interested node.Usually, when the visitor gets off from walking device, the given filtrator of meeting, if this node is interested node, then filtrator can return True, otherwise can return False.
Assistant (Helper) The node assistant is the matched node type, knows its structure and comprises the class of the method that is used to use and change this node.Assistant's note has the node structure a position, makes the change of this structure is implemented easily.
Delver (Miner) Delver is to navigate within tree construction, up to the program that finds interested node.When finding such node, then collect all information, and these information are saved in the database about this node.Delver know its structure of interested node.
Standard nodes (Standard Node) Standard nodes is the title that is used to imitate the class of each node on the standard tree.It comprises: have a plurality of attributes about the information of specific node; With a plurality of attributes of this node link to the tram of setting; And be used to increase about the information of node or a plurality of methods of running node.
Standard tree (Standard Tree) Storage is about the tree construction of the information of application program.
WSL Wide spectrum language (Wide-Spectrum Language)
Walk device (Traversers) Walking device is the simple class of walking on standard tree with ad hoc fashion---up or down, or at first advance, or at first advance to the brotgher of node to the degree of depth.Usually, walk device portability Accessor Classes.
Tree walker Tree walker is the traversal standard tree, and carries out the process of particular task---in some way tree is changed usually.
Visitor (Visitor) The visitor has the class that particular task will be finished.They are carrying on standard tree and are advancing by walking device, think each node of interested node walking device, walk device and just stop, and the visitor can carry out its task.

Claims (61)

1. an establishment comprises the method for the tree of a plurality of nodes, and this tree is ready to use in executable code in the conversion of different programming languages, and this method comprises:
Receive described executable code;
Discern each executable section of described code;
Node of each executable section distribution for described code, wherein each node belongs to one of one group of destined node type, but a unique general executable operations of described each destined node type definition programming language, the structure of each node and content are determined by the general operation of its node type definition; With
Link a plurality of nodes to create this tree.
2. the method for claim 1, but wherein said unique general executable operations is:
To quoting of another code constituent element;
Assignment statement;
DPS;
Conditional statement; Or
Loop statement.
3. method as claimed in claim 1 or 2, wherein for each node type, its structure comprises one or more child node, and wherein each child node belongs to one of one group of predetermined child node type, but a possibility constituent element of described each its general executable operations of child node type definition.
4. method as claimed in claim 3, wherein for each child node type, its structure comprises one or more child node again, wherein each again child node belong to one group of predetermined one of child node type again, but described each one of constituent element of its general executable operations of child node type definition may sub-component again.
5. the described method of arbitrary as described above claim, wherein in this tree, the child node type of variable that uses in the described executable code and defining variable appears in this tree explicitly.
6. the described method of arbitrary as described above claim, wherein in this tree, the mathematical equation of using in the described executable code appears in this tree explicitly with the child node type that defines the mathematic(al) representation that uses in the described equation.
7. the described method of arbitrary as described above claim, wherein in this tree, the child node type of constant that uses in the described executable code and defconstant appears in this tree explicitly.
8. the described method of arbitrary as described above claim, wherein each node comprises identifying information, for example distributes to the row number of the executable section in the described executable code.
9. the described method of arbitrary as described above claim, wherein by distribute link information that this node link is set to this to each node, described link information is with that this node link is gone up other required node to this tree is relevant, for example the details of the father node of this node and child node.
10. the described method of arbitrary as described above claim, wherein each node has unique identifier.
11. the described method of arbitrary as described above claim, wherein each node further comprises a plurality of methods, and how these a plurality of methods carries out the exercises that are used for the assist process tree if relating to.
12. the described method of arbitrary as described above claim, wherein each node further comprises a marker, and this marker can be used by the described the whole bag of tricks that is used for the assist process tree; For example, the method for indicating is performed on this node.
13. the described method of arbitrary as described above claim, wherein said method further comprises:
Receive the claim data that is associated with described executable code;
Discern each declare section of described claim data;
Be node of each declare section distribution of described code, this node belongs to the node type of definition statement; And
This declaration node is linked to this tree.
14. the described method of arbitrary as described above claim, the node type of wherein said definition declaration node comprise following any or more a plurality of:
Identifying information is for example distributed to the row number of described claim data;
With the link information of this node link to this tree;
Help to handle a plurality of methods of tree; And
Unique identifier.
15. set up resolver and comprise the method for the tree of a plurality of nodes with establishment for one kind, this tree is ready to use in the conversion of executable code from first programming language to second programming language, this method comprises:
At described first programming language, but from the code of writing with described first programming language, identify the grammer of definition executable operations;
Be the grammer distribution node type that identifies, wherein each node type is one of one group of destined node type, but a unique general executable operations of described each destined node type definition programming language; The structure of each node type and content are determined by the general operation of its node type definition;
Repeat this method, but all be identified and all be assigned with node type until grammer at all executable operations of described first operating language.
16. method as claimed in claim 15, but wherein said unique general executable operations is:
To quoting of another code constituent element;
Assignment statement;
DPS;
Conditional statement; Or
Loop statement.
17. as claim 15 or 16 described methods, wherein for each node type, its structure comprises one or more child node, and wherein each child node belongs to one of one group of predetermined child node type, but a possibility constituent element of each its general executable operations of child node type definition.
18. method as claimed in claim 17, wherein for each child node type, its structure comprises one or more child node again, wherein each again child node belong to one group of predetermined one of child node type again, but described each possible sub-component of the constituent element of its general executable operations of child node type definition again.
19. as each described method in the claim 15 to 18, wherein comprise the node type of the general operation of variable purposes for definition, the node type of this general operation is associated with the child node type of defining variable.
20. as each described method in the claim 15 to 19, wherein comprise the node type of the general operation of variable purposes for definition, the node type of this general operation is associated with the child node type of defining variable.
21. as each described method in the claim 15 to 20, wherein for the node type of the general operation that defines mathematical equation, the node type of this general operation is associated with the child node type of definition mathematic(al) representation.
22. as each described method in the claim 15 to 21, wherein comprise the node type of the general operation of constant purposes for definition, the node type of this general operation is associated with the child node type of defconstant.
23. as each described method in the claim 15 to 22, wherein the structure of each node type comprises the ability of storaging identificating information, described identifying information is for example distributed to the row number of the executable section in the described executable code.
24. as each described method in the claim 15 to 23, wherein the structure of each node type comprises the ability of stores link information, described link information is with that how this node type can be linked to other node is relevant.
25. as each described method in the claim 15 to 24, wherein the structure of each node type has the ability of unique identifier of this node of storage.
26. as each described method in the claim 15 to 25, wherein each node type further comprises and relates to a plurality of methods of how carrying out exercises, described action is in being placed in tree the time, the assist process node type.
27. as each described method in the claim 15 to 26, wherein each node type further comprises a marker, this marker can be used by a plurality of methods of described assist process tree on being placed in tree the time.
28. a resolver is applicable to that enforcement of rights requires each described method in 1 to 14.
29. a resolver, it is set up according to each described method in the claim 15 to 27.
30. an application software, it can make the computer system operation require each described method in 1 to 14 with enforcement of rights.
31. an application software, it can make the computer system operation require each described method in 15 to 27 with enforcement of rights.
32. one kind is converted to the computer system of different programming languages with executable code, this computer system has:
Input tool is used to receive described executable code;
Storage tool is used to the code of storing application software and being received; With
Handling implement is used for using described application software to come enforcement of rights to require 1 to 14 each described method.
33. computer system as claimed in claim 32 further comprises the output instrument, is used for exporting described executable code with described different programming language.
34. one kind is converted to the computer system of second programming language with executable code from first programming language, this computer system comprises:
Storage tool is used to store application software and described executable code; And
Handling implement is used for using described application software enforcement of rights to require 15 to 27 each described methods.
35. one kind is converted to the method for second programming language with executable code from first programming language, described method comprises:
Create tree with each described method in the claim 1 to 14;
At each node on the tree, but the executable operations of definition is transcribed into the grammer of second programming language.
36. one kind is the method for different programming languages with code conversion, this method comprises:
Receive described code;
Create abstract syntax tree based on described executable code;
The recognition data that will be referred to a plurality of processes of rebuilding is stored in the data-carrier store, and described a plurality of processes of rebuilding are treated on described abstract syntax tree operation rebuilding this tree, thereby assist described code conversion of arriving different language;
On described abstract syntax tree, operate in the process of rebuilding that identifies in the described data-carrier store automatically;
Automatic operation configuration process on the tree of this reconstruction is being described different programming language with described code conversion;
Code after the assessment conversion, and based on this assessment, identify another and treat that operation is to assist the described process of rebuilding that arrives the code conversion of different language on described abstract syntax tree;
The recognition data of described another process of rebuilding is stored in the described data-carrier store; And
Repeat described operating procedure.
37. further comprising, method as claimed in claim 36, wherein said method receive data dictionary, metadata or any other file relevant with the code that is received.
38. as claim 36 or 37 described methods, wherein said abstract syntax tree utilizes each described method establishment in the claim 1 to 16.
39. as claim 36,37 or 38 described methods, wherein said method further comprises: described abstract syntax tree is stored in step in the described data-carrier store.
40. method as claimed in claim 39, the step of wherein said establishment abstract syntax tree further comprises: extract the statement element from described abstract syntax tree, and it is stored in the data-carrier store.
41. method as claimed in claim 40, wherein said statement element utilize a plurality of excavation processes to extract from described abstract syntax tree, described a plurality of excavation processes are excavated to discern the statement element in this tree described abstract syntax tree.
42. as claim 40 or 41 described methods, wherein said each statement attribute of an element is stored in the described data-carrier store.
43. as each described method in the claim 39 to 42, wherein said method further comprises: will analyze data storage in described data-carrier store, described analysis data relate to the element that how to use and use described code wherein.
44. as each described method in the claim 39 to 43, wherein said method comprises: will with the step of described code dependent metadata store in the described data-carrier store.
45. method as claimed in claim 44, wherein said metadata comprise following one or more kinds:
Information about the source language of described code and/or described different programming language;
The built-in constituent element of the source language of described code and/or described different programming language; And
The information that relates to reconstruction, for example required maintainability, complicacy and efficient when the operation of code of conversion.
46. as claim 44 or 45 described methods, wherein use a plurality of excavation processes, extract one or more part of described metadata from described abstract syntax tree.
47. as each described method in the claim 36 to 46, wherein said process of rebuilding comprise following one or more:
The process of hoping loop structure is by a definite date discerned and is rebuild in circulation;
The more process of fine structure is discerned and be redeveloped into to specific executable section;
GOTO statement in the described abstract syntax tree is discerned, laid equal stress on and contribute to remove the process of these statements;
Duplicate to the one-tenth group node in this tree is discerned, and rebuilds so that this group node is created as the process of function or process;
The process that the action scope of one or more variable is discerned;
Particular node group in the described abstract syntax tree is discerned, and reset the process of the structure of these nodes;
Particular node group in the described abstract syntax tree is discerned, and replaced the process of these nodes, for example used function call;
Data structure is changed into the process of the 3rd canonical form;
Travel through the process of this tree with the identification interface; And
Travel through the purposes of this tree and situational variables, to improve the process of its types of variables.
48. as each described method in the claim 36 to 47, wherein said method further comprises: write the described process of rebuilding on abstract syntax tree, moved treated.
49. as each described method in the claim 39 to 46, wherein said method further comprises:, have or not information dropout with identification to being stored in the information and executing audit in the described data-carrier store.
50. as each described method in the claim 36 to 49, the wherein said step that operates in the process of rebuilding that identifies in the described data-carrier store automatically, also use be stored in the described data-carrier store with code dependent claim information and metadata information.
51., wherein move two or more processes of rebuilding simultaneously as each described method in the claim 36 to 50.
52. method as claimed in claim 39, the step of wherein said automatic operation configuration process is also used in the described data-carrier store and the code dependent information of being stored in.
53. as each described method of claim 36 to 52, wherein to the assessment of the code after the conversion based on following any one or more multinomial:
The order complicacy of described code;
The line number of code;
The number of the process that has been replaced;
Manual evaluation to the code after the conversion; And
The accuracy of the code after the configuration.
54. as each described method in the claim 36 to 53, the step of the code after the wherein said assessment conversion is based on described abstract syntax tree.
55. as each described method in the claim 36 to 54, the code after the wherein said assessment conversion comprises: generate the objection report, possibly can't produce required result's part in the code after the described conversion of described objection report identification.
56. method as claimed in claim 39, wherein before the code after the assessment conversion, described method comprises: with the step of the code storage after the described conversion in described data-carrier store.
57. method as claimed in claim 56 is comprising the code after the conversion that the code after the conversion of the preceding iteration of this method is replaced with latest edition.
58. as any two or more multinomial described method in the claim 39 to 46,49,52,56 or 57, wherein said data-carrier store is same data-carrier store.
59. an application software, it can enforcement of rights require each described method in 36 to 59.
60. a computer system that is used for transcode, this computer system has:
Input tool is used to receive described code;
Storage tool is used to the code of storing application software and being received; And
Handling implement is used for using described application software enforcement of rights to require 36 to 59 each described methods.
61. computer system as claimed in claim 60, wherein said computer system further comprise the data-carrier store of each information in the storage claim 39 to 46,49,52,56 or 57.
CNA2006800232036A 2005-06-27 2006-06-27 Code transformation Pending CN101208660A (en)

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
AU2005903390 2005-06-27
AU2005903390A AU2005903390A0 (en) 2005-06-27 Code Transformation
AU2005905559 2005-10-07
AU2005905868 2005-10-19

Related Child Applications (1)

Application Number Title Priority Date Filing Date
CN200910205846.8A Division CN101770363B (en) 2005-06-27 2006-06-27 Method and device for transformation of executable code from into different programming language

Publications (1)

Publication Number Publication Date
CN101208660A true CN101208660A (en) 2008-06-25

Family

ID=39567867

Family Applications (1)

Application Number Title Priority Date Filing Date
CNA2006800232036A Pending CN101208660A (en) 2005-06-27 2006-06-27 Code transformation

Country Status (1)

Country Link
CN (1) CN101208660A (en)

Cited By (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102591647A (en) * 2010-12-27 2012-07-18 微软公司 Converting desktop applications to web applications
CN103140838A (en) * 2010-10-27 2013-06-05 株式会社日立制作所 Method of converting source code and source code conversion program
CN104484192A (en) * 2015-01-07 2015-04-01 南威软件股份有限公司 Automatic generating method for complex multiple-branching structure code
CN106445564A (en) * 2016-12-23 2017-02-22 携程旅游网络技术(上海)有限公司 Mixed reference method and mixed reference system for items with different programming languages of platform
CN106775935A (en) * 2016-12-01 2017-05-31 携程旅游网络技术(上海)有限公司 The analytic method and its device and computer system of interpreted languages
CN107861728A (en) * 2017-10-25 2018-03-30 深圳四方精创资讯股份有限公司 Method from traditional program language to modern procedures language conversion and its system for
CN109299133A (en) * 2017-07-24 2019-02-01 迅讯科技(北京)有限公司 Data query method, computer system and non-transitory computer-readable medium
CN109657103A (en) * 2018-12-19 2019-04-19 广州天鹏计算机科技有限公司 Conversion method, device, computer equipment and the storage medium of data structure
CN109739512A (en) * 2018-12-28 2019-05-10 江苏极光网络技术有限公司 A kind of analytical type language text formula analysis conversion method
CN110377291A (en) * 2019-06-19 2019-10-25 深圳壹账通智能科技有限公司 Structural data conversion method, device, computer equipment and storage medium
CN110554875A (en) * 2018-05-30 2019-12-10 北京三快在线科技有限公司 Code conversion method and device, electronic equipment and storage medium
CN110806877A (en) * 2018-08-06 2020-02-18 北京京东尚科信息技术有限公司 Method, device, medium and electronic equipment for structuring programming file
CN110879710A (en) * 2019-07-24 2020-03-13 中信银行股份有限公司 Method for automatically converting RPG program into JAVA program
CN112204531A (en) * 2017-02-14 2021-01-08 探求自动化服务有限公司 Automation Control System
CN113986252A (en) * 2021-10-29 2022-01-28 中国银行股份有限公司 COBOL code conversion method and device
CN114159799A (en) * 2021-12-06 2022-03-11 网易(杭州)网络有限公司 Method and device for optimizing game script
CN114428615A (en) * 2022-01-26 2022-05-03 北京有竹居网络技术有限公司 CSS compiling method, style updating method, device, medium and equipment
CN114942782A (en) * 2021-09-24 2022-08-26 华为技术有限公司 Code migration method and device of model
CN119127299A (en) * 2024-11-11 2024-12-13 彩讯科技股份有限公司 Data migration method and device based on multi-dimensional evaluation system
CN119127299B (en) * 2024-11-11 2025-04-11 彩讯科技股份有限公司 Data migration method and device based on multi-dimensional evaluation system

Cited By (33)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103140838A (en) * 2010-10-27 2013-06-05 株式会社日立制作所 Method of converting source code and source code conversion program
CN103140838B (en) * 2010-10-27 2015-06-17 株式会社日立制作所 Method of converting source code
US9176742B2 (en) 2010-12-27 2015-11-03 Microsoft Technology Licensing, Llc Converting desktop applications to web applications
CN102591647B (en) * 2010-12-27 2016-01-20 微软技术许可有限责任公司 Desktop application is converted to web application
TWI552075B (en) * 2010-12-27 2016-10-01 微軟技術授權有限責任公司 Converting desktop applications to web applications
CN102591647A (en) * 2010-12-27 2012-07-18 微软公司 Converting desktop applications to web applications
CN104484192B (en) * 2015-01-07 2017-11-14 南威软件股份有限公司 A kind of method of complicated multiple-branching construction Code automatic build
CN104484192A (en) * 2015-01-07 2015-04-01 南威软件股份有限公司 Automatic generating method for complex multiple-branching structure code
CN106775935B (en) * 2016-12-01 2019-09-24 携程旅游网络技术(上海)有限公司 The analytic method and its device and computer system of interpreted languages
CN106775935A (en) * 2016-12-01 2017-05-31 携程旅游网络技术(上海)有限公司 The analytic method and its device and computer system of interpreted languages
CN106445564B (en) * 2016-12-23 2019-08-20 携程旅游网络技术(上海)有限公司 There is the mixing quoting method and system of different programming language projects for same platform
CN106445564A (en) * 2016-12-23 2017-02-22 携程旅游网络技术(上海)有限公司 Mixed reference method and mixed reference system for items with different programming languages of platform
CN112204531B (en) * 2017-02-14 2024-12-20 探求自动化服务有限公司 Automation control system
CN112204531A (en) * 2017-02-14 2021-01-08 探求自动化服务有限公司 Automation Control System
CN109299133A (en) * 2017-07-24 2019-02-01 迅讯科技(北京)有限公司 Data query method, computer system and non-transitory computer-readable medium
CN107861728A (en) * 2017-10-25 2018-03-30 深圳四方精创资讯股份有限公司 Method from traditional program language to modern procedures language conversion and its system for
CN110554875B (en) * 2018-05-30 2021-01-15 北京三快在线科技有限公司 Code conversion method and device, electronic equipment and storage medium
CN110554875A (en) * 2018-05-30 2019-12-10 北京三快在线科技有限公司 Code conversion method and device, electronic equipment and storage medium
CN110806877B (en) * 2018-08-06 2024-04-16 北京京东尚科信息技术有限公司 Method, device, medium and electronic equipment for structuring programming file
CN110806877A (en) * 2018-08-06 2020-02-18 北京京东尚科信息技术有限公司 Method, device, medium and electronic equipment for structuring programming file
CN109657103A (en) * 2018-12-19 2019-04-19 广州天鹏计算机科技有限公司 Conversion method, device, computer equipment and the storage medium of data structure
CN109739512B (en) * 2018-12-28 2022-04-12 江苏极光网络技术有限公司 Analytic language text type analysis and conversion method
CN109739512A (en) * 2018-12-28 2019-05-10 江苏极光网络技术有限公司 A kind of analytical type language text formula analysis conversion method
CN110377291A (en) * 2019-06-19 2019-10-25 深圳壹账通智能科技有限公司 Structural data conversion method, device, computer equipment and storage medium
CN110879710A (en) * 2019-07-24 2020-03-13 中信银行股份有限公司 Method for automatically converting RPG program into JAVA program
CN110879710B (en) * 2019-07-24 2023-07-07 中信银行股份有限公司 Method for automatically converting RPG program into JAVA program
CN114942782A (en) * 2021-09-24 2022-08-26 华为技术有限公司 Code migration method and device of model
CN113986252A (en) * 2021-10-29 2022-01-28 中国银行股份有限公司 COBOL code conversion method and device
CN114159799A (en) * 2021-12-06 2022-03-11 网易(杭州)网络有限公司 Method and device for optimizing game script
CN114428615A (en) * 2022-01-26 2022-05-03 北京有竹居网络技术有限公司 CSS compiling method, style updating method, device, medium and equipment
CN114428615B (en) * 2022-01-26 2024-05-17 北京有竹居网络技术有限公司 CSS compiling method, style updating device, medium and equipment
CN119127299A (en) * 2024-11-11 2024-12-13 彩讯科技股份有限公司 Data migration method and device based on multi-dimensional evaluation system
CN119127299B (en) * 2024-11-11 2025-04-11 彩讯科技股份有限公司 Data migration method and device based on multi-dimensional evaluation system

Similar Documents

Publication Publication Date Title
CN101770363B (en) Method and device for transformation of executable code from into different programming language
CN101208660A (en) Code transformation
Tilley et al. A survey of formal concept analysis support for software engineering activities
Kolovos et al. A research roadmap towards achieving scalability in model driven engineering
Bézivin et al. Reflective model driven engineering
US20130227533A1 (en) Code transformation
Smaragdakis et al. DiSTiL: A Transformation Library for Data Structures.
Taylor et al. A framework for model integration in spatial decision support systems
Mammar et al. From a B formal specification to an executable code: application to the relational database domain
Müller et al. The Coq library as a theory graph
AU2012201466B2 (en) Code Transformation
Guskov et al. Ontological mapping for conceptual models of software system
Mou et al. Visual life sciences workflow design using distributed and heterogeneous resources
Sáenz-Adán et al. Automating provenance capture in software engineering with UML2PROV
Šimůnek LISp-Miner Control Language–description of scripting language implementation
Washizaki et al. A taxonomy for program metamodels in program reverse engineering
Bowen et al. The REDO Project
Akers et al. Case study: Re-engineering C++ component models via automatic program transformation
Irani et al. Sahand 1.0: A new model for extracting information from source code in object-oriented projects
Fraternali et al. Almost rerere: An approach for automating conflict resolution from similar resolved conflicts
Galasso et al. Fine-Grained Analysis of Similar Code Snippets
Kovše Model-driven development of versioning systems
Rencis Model transformation languages l1, l2, l3 and their implementation
Cuzzocrea et al. Enhancing coverage and expressive power of spatial data warehousing modeling: The SDWM approach
Silva-Lepe Techniques for Reverse-engineering and Re-engineering into the Object-Oriented Paradigm

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication

Open date: 20080625