CN115167834B - Automatic source code generation method and device based on code datamation - Google Patents
Automatic source code generation method and device based on code datamation Download PDFInfo
- Publication number
- CN115167834B CN115167834B CN202211092259.4A CN202211092259A CN115167834B CN 115167834 B CN115167834 B CN 115167834B CN 202211092259 A CN202211092259 A CN 202211092259A CN 115167834 B CN115167834 B CN 115167834B
- Authority
- CN
- China
- Prior art keywords
- source file
- grammar
- code
- statement
- name
- 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.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/31—Programming languages or programming paradigms
- G06F8/315—Object-oriented languages
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
- G06F16/2282—Tablespace storage structures; Management thereof
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/25—Integrating or interfacing systems involving database management systems
- G06F16/252—Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/33—Intelligent editors
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Computing Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention relates to a source code automatic generation method and a device based on code datamation, comprising the following steps: establishing a plurality of grammar structure storage tables in a database, wherein columns of the grammar structure storage tables also comprise grammar structure IDs and parent grammar structure IDs; sequentially reading the grammar structures of the template engineering, adding sentence records in a corresponding grammar structure storage table to obtain grammar structure IDs, and filling in the father grammar structure IDs if the father grammar structures exist; all template projects are added to the database to complete code datamation; finding out corresponding template engineering; reading a source file table from a database, and finding all subdata of source file data; and traversing each piece of data of the source file in sequence in a recursion manner, finding all subdata of the current source file table, and completing restoration of the source code. The beneficial technical effects of the invention comprise: the code can be processed by a plurality of data processing methods, so that the development efficiency of the code is improved, and the development of software technology is promoted.
Description
Technical Field
The invention relates to a source code automatic generation method and device based on code datamation.
Background
The information technology is changing day by day, and the method quickly permeates the social aspects and greatly changes the life appearance of people. However, as the most important carrier of information technology, the program code exists only as text and has no definite structural relationship. The modern information processing means is difficult to be applied to the program codes, so that the compiling, the analysis and the modification of the codes can be completed only by programmers manually, and the efficiency is extremely low. A need arises for a new type of program representation that is equivalent to program code, but that can be implemented by applying modern information processing techniques.
For example, chinese patent CN113867716A, published 2021, 12 and 31, a code automatic generation method and device for application function development, the method includes establishing a thinking guide diagram representing the system according to preset logic; automatically generating preset function codes of all applications in the system based on the mind map; and calling a self-defined code through a preset interface in the code to automatically fuse the self-defined code into a code with a preset function to obtain an original code of the application. The method comprises the steps of establishing a mind map of a system, automatically generating codes of preset functions aiming at the mind map, and automatically fusing the codes of the preset functions and custom codes to complete code development when the functions of the application are improved, so that the code development efficiency is improved. However, the technical scheme still cannot solve the problem that the code lacks structural relationship, so that the automatic processing of the code is difficult to perform.
Disclosure of Invention
The technical problems to be solved by the invention are as follows: the prior art is difficult to carry out automatic processing on codes, so that the code development efficiency is low. The method and the device for automatically generating the source code based on the code datamation are provided, so that the structured representation of the code is realized, and the development efficiency of the code is improved.
The technical scheme adopted by the invention is as follows: a source code automatic generation method based on code datamation comprises the following steps:
acquiring a plurality of template projects, and adding function descriptions of the template projects;
establishing a plurality of grammar structure storage tables in a database, wherein each grammar structure corresponds to one grammar structure storage table, the column structure of the grammar structure storage table corresponds to the parameter of the grammar structure, and the column of the grammar structure storage table also comprises a grammar structure ID and a father grammar structure ID;
sequentially reading the grammar structures of the template engineering, adding sentence records in corresponding grammar structure storage tables to obtain grammar structure IDs, and filling in the father grammar structure IDs if the grammar structures have father grammar structures;
after all the template projects are added to the database, the datamation of the codes is completed;
reading a source file table from a database, inquiring the database, and finding out all source file data required by a new project;
sequentially and recursively traversing each source file data to find all subdata of the current source file data;
and completing restoration of the source code according to the source file data and the corresponding subdata, namely completing automatic generation of the source code of the new project.
Preferably, the syntax structure storage table includes a source file table, a namespace member table, a class declaration table, a statement table, an expression table, a dual-operand expression table and a variable declaration table, the source file table records source file information included in the template project, the source file information includes a source file name and a template project name, the namespace table records all namespace information included in the template project, the namespace member table records multiple naming member information of the template project, the class declaration table records class declaration information included in the template project, the statement table records statement information included in the template project, the expression table records expression information included in the template project, the dual-operand expression table records dual-operand expression information included in the template project, and the variable declaration table records variable declaration information used by the template project.
Preferably, the method for adding the syntax structure record to the corresponding syntax structure storage table includes:
reading a project name of a template project, wherein the project name comprises a project file name and a solution name;
traversing each source file under the template engineering, and adding source file information in a source file table, wherein the source file information comprises an engineering name, a source file ID and a namespace ID;
establishing a syntax tree of a source file;
traversing the access syntax tree, and executing the following steps:
reading a currently accessed grammar node, and judging the type of the grammar node;
if the statement is a class declaration statement, adding class declaration information in a class declaration table, wherein the class declaration information comprises a class name, a namespace ID, a class ID and a source file ID to which the class declaration information belongs;
if the statement is a function statement, adding function statement information in a statement table, wherein the function statement information comprises a function type, a grammar structure name, a grammar structure ID and a father grammar structure ID;
if the syntax structure is a single-operand expression syntax structure, adding expression information in an expression table, wherein the expression information comprises an expression type, an expression ID and a father syntax structure ID;
if the expression is of a double-operand expression syntactic structure, adding double-operand expression information in a double-operand expression table, wherein the double-operand expression information comprises an expression type, an expression ID, a father syntactic structure ID and an expression name;
if the statement is a function statement syntactic structure, a single-operand expression syntactic structure, a double-operand expression syntactic structure or a variable statement, the function statement syntactic structure, the single-operand expression syntactic structure, the double-operand expression syntactic structure and variable information used by the variable statement information are added into a variable statement table, wherein the variable information comprises a variable name, a variable type, a variable initial value, a variable ID, a parent syntactic structure ID and a namespace ID.
Preferably, the method of obtaining the namespace ID of the class declaration information includes: and acquiring the name of the name space used by the class, inquiring the name space ID of the corresponding name space in the name space table, and if the corresponding name space does not exist, adding the name space in the name space table to acquire the corresponding name space ID.
Preferably, after a syntax tree of the source file is established, a syntax tree root node is accessed to generate a namespace member object;
when traversing the syntax tree and traversing a class statement syntax structure, establishing a temporary table and recording a class ID and a naming space ID used by the class;
after traversing the syntax tree, updating a name space member table according to the temporary table, and adding name space member information of the name space member object in the name space member table, wherein the name space member information comprises a name space ID, a class ID and a source file ID.
Preferably, the method of restoring the source code of the source file comprises:
finding a corresponding template project according to the functional requirements of the new project, and inquiring a database according to the name of the corresponding template project to obtain all matched source file information and corresponding source file IDs;
reading a source file table from a database, inquiring the database, and finding out all source file data required by a new project;
sequentially recursively traversing each source file data to find all subdata of the current source file data;
building tree structures for the source file data and the subdata, and generating statement codes according to the serialized files of each tree structure;
filling the subdata and the corresponding variable into the statement code according to the corresponding subdata, and completing restoration of a source code of the subdata;
and (4) completing restoration of the source code by all the subdata, namely completing automatic generation of the source code of the new project.
A source code automatic generation device based on code datamation executes the source code automatic generation method based on code datamation, and comprises a template engineering input module, a code datamation module, a new engineering establishment module and a code recovery module, wherein the template engineering input module receives a plurality of template engineering and corresponding function description, the code datamation module establishes a plurality of grammar structure storage tables in a database, the source codes of the template engineering are stored in a relational database, the new engineering establishment module establishes a new engineering according to a new engineering name submitted by a user and a selected template engineering name, and forwards the corresponding template engineering name to the code recovery module, and the code recovery module reads and recovers the source codes of the corresponding template engineering name from the relational database.
Preferably, when the code datamation module stores the source code of the template project in the relational database, the following steps are executed: establishing a plurality of grammar structure storage tables in a database, wherein each grammar structure corresponds to one grammar structure storage table; the column structure of the grammar structure storage table corresponds to parameters of a grammar structure, the column of the grammar structure storage table also comprises a grammar structure ID and a father grammar structure ID, the grammar structure of the template engineering is read in sequence, grammar structure records are added in the corresponding grammar structure storage table to obtain the grammar structure ID, and if the grammar structure has the father grammar structure, the father grammar structure ID is filled; after all the template projects are added to the database, the datamation of the codes is completed; according to the functional requirements of the new project, a corresponding source file data table is found, a database is inquired, each piece of data of the source file is traversed recursively in sequence, all subdata of the current source file table is found, a tree structure is built for the source file data and the subdata, restoration of a source code is completed by utilizing a serialized file of each tree structure, and then automatic generation of the source code of the new project is completed.
The beneficial technical effects of the invention comprise: the source code is converted into a structure which can be stored in a relational database, so that the relational structure of the code is effectively established, the code can be processed by a plurality of data processing methods, and a more complex and more automatic code management and generation mode is realized; the template engineering is provided, so that the engineering code needing to be repeatedly developed can be completed by only developing once and then developing a small amount of codes, the development efficiency of the codes is effectively improved, and the development of software technology is promoted.
Other features and advantages of the present invention will be disclosed in more detail in the following detailed description of the invention and the accompanying drawings.
Drawings
The invention is further described below with reference to the accompanying drawings:
fig. 1 is a schematic flow chart of an automatic source code generation method according to an embodiment of the present invention.
Fig. 2 is a flowchart illustrating an add statement recording method according to an embodiment of the present invention.
FIG. 3 is a flowchart illustrating a method for generating a member object of a name space according to an embodiment of the present invention.
Fig. 4 is a flowchart illustrating a method for restoring a source code according to an embodiment of the present invention.
Fig. 5 is a schematic flow chart of a source code automatic generation method according to an embodiment of the present invention.
Wherein: 10. the system comprises a template engineering input module 20, a code datamation module 30, a new engineering building module 40 and a code recovery module.
Detailed Description
The technical solutions of the embodiments of the present invention are explained and illustrated below with reference to the drawings of the embodiments of the present invention, but the following embodiments are only preferred embodiments of the present invention, and not all embodiments. Other embodiments obtained by persons skilled in the art without making creative efforts based on the embodiments in the implementation belong to the protection scope of the invention.
In the following description, the appearances of the indicating orientation or positional relationship such as the terms "inner", "outer", "upper", "lower", "left", "right", etc. are only for convenience in describing the embodiments and for simplicity in description, and do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and are not to be construed as limiting the present invention. The first embodiment is as follows:
a method for automatically generating source code based on code datamation, referring to fig. 1, comprising the following steps:
step A01) obtaining a plurality of template projects, and adding function descriptions of the template projects;
step A02) establishing a plurality of grammar structure storage tables in a database, wherein each grammar structure corresponds to one grammar structure storage table, the column structure of the grammar structure storage table corresponds to the parameter of the grammar structure, and the column of the grammar structure storage table also comprises a grammar structure ID and a father grammar structure ID;
step A03) reading grammar structures of the template engineering in sequence, adding statement records in corresponding grammar structure storage tables to obtain grammar structure IDs, and filling in the father grammar structure IDs if the grammar structures have father grammar structures;
step A04) finishing the datamation of the codes after all the template projects are added to the database;
step A05) reading a source file table from a database, inquiring the database and finding all source file data required by a new project;
step A06) recurrently traversing each source file data in sequence to find all subdata of the current source file data;
and A07) completing the restoration of the source code according to the source file data and the corresponding subdata, namely completing the automatic generation of the source code of the new project.
The template project is a set of functional software for completing a project or task, such as an office management project or a logistics management project. There are only slight differences between different office management projects, and most functions are the same. I.e. most of the source code is also the same. However, at present, the source code in the text format is directly used, and automatic code generation is difficult to realize. Still need the multiplexing and the development of technical staff manual completion code, it is extremely inefficient.
In this embodiment, the syntax structure storage table includes a source file table, a namespace member table, a class declaration table, a statement table, an expression table, a dual-operand expression table, and a variable declaration table, the source file table records source file information included in the template project, the source file information includes a source file name and a template project name, the namespace table records all namespace information included in the template project, the namespace member table records a plurality of naming member information of the template project, the class declaration table records class declaration information included in the template project, the statement table records statement information included in the template project, the expression table records expression information included in the template project, the dual-operand expression table records dual-operand expression information included in the template project, and the variable declaration table records variable declaration information used by the template project.
In this patent, the syntax structure storage table is a generic name, and the source file table, the namespace table and the namespace member table are also included in the category of the syntax structure storage table. The reason is that although the source file, the namespace and the namespace member do not belong to the syntactic structure, tables to be used when the statements in the syntactic structure and the syntactic structure are restored have functions similar to those of the class declaration table, the statement table, the expression table, the dual-operand expression table and the variable declaration table. Syntax structures in the art include sequential syntax structures, selection syntax structures, loop syntax structures, and modular syntax structures, and all statements in the source code may be incorporated into the syntax structures. This patent is not limited to constructing and using the 4 grammar structures described above. The present invention protects the syntax structure partitioning scheme as long as the syntax structure partitioning scheme can be used in cooperation with the syntax structure storage table. In this patent, the meaning of the records and data rows in the database is the same as the sub-data.
The class declaration table records class declaration information, and the class declaration information comprises the name, the static type, the global or local declaration and parameter-containing information of the class. For example, a class declares public static class dataaccess base, the name of the class is dataaccess base, a global or local declaration is public, parameter information is null, and a static type is static, that is, the class belongs to a static class. The included parameter information includes each parameter name and parameter type. For restoring declaration statements of classes. The class declaration table records statement IDs of classes, all statements contained in a class are respectively recorded in the statement table, the expression table and the two-operand expression table according to statement types, and the records are added with the statement IDs of the classes in parent statement IDs. The sentences contained in all the classes can be found by inquiring the sentence IDs of the classes. Since the statements contained in the class are added to the database, they are added sequentially in the order of the statements in the source file. Thus, between statements at the same level, the order of the statements is determined by the time added to the database. Namely, the source file table, the name space member table, the class declaration table, the statement table, the expression table, the two-operand expression table and the variable declaration table all contain an addition time column to record the time when the statement is added to the database.
Referring to fig. 2, the method for adding syntax structure records to the corresponding syntax structure storage table includes:
step B01) reading the project name of the template project, wherein the project name comprises a project file name and a solution name;
step B02) traversing each source file under the template engineering, and adding source file information in a source file table, wherein the source file information comprises an engineering name, a source file ID and a namespace ID;
step B03) establishing a syntax tree of the source file;
step B04) traversing the access syntax tree, and executing the following steps:
step B05), reading the currently accessed grammar node and judging the grammar node type;
step B06), if the statement is a class declaration statement, adding class declaration information in a class declaration table, wherein the class declaration information comprises a class name, a namespace ID, a class ID and a source file ID to which the class declaration belongs;
step B07), if the statement is a function declaration statement, adding function declaration statement information in a statement table, wherein the function declaration statement information comprises a function type, a grammar structure name, a grammar structure ID and a father grammar structure ID;
step B08), if the syntax structure is a single-operand expression syntax structure, adding expression information in an expression table, wherein the expression information comprises an expression type, an expression ID and a father syntax structure ID;
step B09) if the syntax structure of the double-operand expression is adopted, adding double-operand expression information in the double-operand expression table, wherein the double-operand expression information comprises an expression type, an expression ID, a father syntax structure ID and an expression name;
and B10) if the statement is a function declaration syntactic structure, a single-operand expression syntactic structure, a double-operand expression syntactic structure or a variable declaration statement, adding variable information used by the function declaration syntactic structure, the single-operand expression syntactic structure, the double-operand expression syntactic structure and the variable declaration statement in a variable declaration table, wherein the variable information comprises a variable name, a variable type, a variable initial value, a variable ID, a father syntactic structure ID and a namespace ID.
The function statement syntax structure is, for example, a statement syntax structure of a for function, and the statement syntax structure of the for function includes a variable initial value, a loop end condition and an execution syntax structure after a single loop. And if the for function is a nested loop, the ID of the upper-layer syntactic structure is used as the parent syntactic structure ID of the present for syntactic structure. All statements in the loop body of the for function take the declaration grammar structure of the for function as a parent grammar structure, and all statements in the loop body can be obtained by query.
The method for obtaining the namespace ID of the class declaration information comprises the following steps: and acquiring the name space name used by the class, inquiring the name space ID of the corresponding name space in the name space table, and if the corresponding name space does not exist, adding the name space in the name space table to acquire the corresponding name space ID.
Referring to fig. 3, the method for creating a namespace member object includes: step C01) after a syntax tree of a source file is established, accessing a syntax tree root node to generate a namespace member object;
step C02) when traversing the syntax tree and traversing the class statement syntax structure, establishing a temporary table and recording the class ID and the name space ID used by the class;
and C03) after traversing the syntax tree, updating the name space member table according to the temporary table, and adding name space member information of the name space member object in the name space member table, wherein the name space member information comprises a name space ID, a class ID and a source file ID.
Referring to fig. 4, a method for restoring source code of a source file includes:
step D01) finding a corresponding template project according to the functional requirements of the new project, and inquiring a database according to the name of the corresponding template project to obtain all matched source file information and a corresponding source file ID;
step D02) reading a source file table from the database, inquiring the database, and finding all source file data required by a new project;
step D03) recurrently traversing each source file data in sequence to find all subdata of the current source file data;
step D04) building tree structures for the source file data and the subdata, and generating statement codes according to the serialized files of each tree structure;
step D05) filling the subdata and the corresponding variable into the statement code according to the corresponding subdata, and restoring the source code of the subdata;
and D06) restoring the source code by all the subdata, namely completing the automatic generation of the source code of the new project.
In the art, the concept of a grammar structure is a composition rule of several sentences. Syntax structures in the art include sequential syntax structures, selection syntax structures, loop syntax structures, and modular syntax structures. Specifically, the sequential syntax structure: the programming of the sequential syntax structure is the simplest, and the execution sequence is from top to bottom, and is executed sequentially. Selecting a grammar structure: the execution of the selection grammar structure is to select an execution path according to a certain condition, and not strictly according to the appearance sequence of the sentences. Selecting a grammar structure to construct proper branch conditions and branch programs, and executing the corresponding branch programs by the programs according to the branch conditions. The loop grammar structure: the loop syntax structure can reduce the workload of repeated writing of the source program and is used for describing the problem of repeated execution, and 4 common loops are selected, namely a goto loop, a while loop, a do while loop and a for loop. Modular grammar structure: the modular grammar structure is realized by functions, namely, a program is divided into a plurality of modules, each module is written into one function, and then the problem is solved by calling between the functions. That is, in the source file, except the source file reference statement, namespace reference statement, solution statement and engineering statement of the head, the rest parts can be classified into the above 4 syntax structures. Header source file reference statements, namespace reference statements, solution statements, and engineering statements may also be treated as funtionality-free functions and incorporated into the modular grammar structure.
In the patent, a single statement in a source code corresponds to a grammar structure. Function declarations in source code are treated as modular grammar structures, class declarations are modular grammar structures, namespace declarations are treated as modular grammar structures, loop function statements are treated as loop grammar structures, and function statements are selected to select grammar structures. Other single statements in the source code are considered as modular syntax structures. A single statement, which is considered a modular grammar structure, can likewise be considered a sequential grammar structure. The concept of syntactic structure in this patent is that the concept of syntactic structure can be conformed in this field, and this patent does not change the concept of syntactic structure, but only uses the conventional use of syntactic structure. The selection grammar structure and the loop grammar structure comprise a selection function and a loop function, and also comprise a selection body and a loop body. While the selection body and the loop body can be interpreted as a local sequential syntax structure or a modular syntax structure.
A source file comprising the following source code segments, the file name of the source file being damo.cs, comprising code:
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
namespace Demo
{
public class DemoClass
{
public void ComplexStructure()
{
for(int i=1;i<10;i++)
{
int forVar = 0;
int j = 10;
while(j>0)
{
forVar += j;
j--;
}
}
}
}
}
the statement segment includes a complexStructure function, which includes a for function, and the for function includes two assignment statements and a while loop function. Wherein the ComplexStructure function is a modular syntax structure and for and while are loop syntax structures. In the invention, the source file is regarded as a modular grammar structure, namely, a nameless function. The 5 using statements, namespace statements, and class declaration statements of the header are treated as modular syntactic structures for the nameless function.
The above statement may split the following syntactic structure: the modular syntax structure of the source file, the modular syntax structure of the ComplexStructure function, the loop syntax structure of the for function, and the loop syntax structure of the while function, total 4 primary syntax structures. And further establishing a syntax tree as follows:
cs modular grammar structure;
a using modular grammar structure;
a using modular grammar structure;
a using modular grammar structure;
a using modular grammar structure;
a using modular grammar structure;
namespace modular grammar structure;
class modular grammar structure;
the ComplexStructure function modular syntax structure;
a for loop grammar structure;
a forVar modular grammar structure;
j modular grammar structure;
while loop syntax structure (j _1 modular syntax structure);
a forVar _1 modular syntax structure;
j _2 modular syntax structure.
The grammar node refers to each grammar structure, and when the grammar structure is subjected to datamation, the nodes in the grammar tree are read in sequence. The source file grammar structure, damo. And a grammar structure storage table corresponding to the source file grammar structure is a source file table. Cs first adds the source file damo to a source file table whose columns include at least a source file name, a belonging project name, a source file ID, and a timestamp. A source file ID of the source file is obtained, and the source file ID is regarded as a syntax structure ID of the source file. The source file information includes the belonging project name, source file ID and namespace ID.
5 using sentences, namespace sentences and class declaration sentences are included under the source file syntax structure. Therefore, 5 using statements, namespace statements and class declaration statements are sequentially added to the corresponding syntax structure tables, i.e. the statement table, namespace table and class declaration table, respectively.
Specifically, the first using statement is a using System, and the corresponding syntax structure storage table is a statement table. The columns of the statement table include at least a statement type, a grammar structure ID, a parent grammar structure ID, a timestamp, and a value. Firstly, adding using to a statement table, wherein the data of the corresponding statement table is as follows: the statement type is using, the father grammar structure ID is the source file ID of the source file damo. Because the statement table stores a variety of statements, and each statement has an indeterminate quantity of parameters and whether there are parameters or not, the parameter System of the statement using System is not recorded in the statement table, but a null value is recorded.
And then adding a data line in the statement table for recording the System. The statement type is String, the father grammar structure ID is grammar structure ID allocated by using in statement using System, the time stamp and the value are System, the grammar structure ID is automatically allocated by database. The subsequent using statement is processed in the same way.
And a grammar structure storage table corresponding to the namespace statement namespace Demo is a namespace table, and the column structure of the namespace table comprises a grammar structure ID, a father grammar structure ID, a timestamp and a value. After the namespace statement namespace Demo is added to the namespace table, the corresponding data row values are: the syntactic structure ID is automatically assigned by the database, the parent syntactic structure ID is the source file ID of the source file damo. The namespace information includes a namespace ID, a parent syntax structure ID, and a namespace name. The namespace ID corresponds to the syntactic structure ID of the namespace table, and the namespace name corresponds to the value of the namespace table.
And a grammar mechanism corresponding to the class declaration statement public class DeMoClass stores a table as a class declaration table, and columns of the class declaration table at least comprise class names, class IDs, parent grammar structure IDs, prefixes, suffixes and timestamps. The generic name of public class Democlass is Democlass, class ID is automatically distributed by a database, parent syntax structure ID is source file ID of a source file damo.cs, prefix is public, suffix is null, and time stamp is system time stamp. The class declaration information includes a class name, a class ID, a belonging source file ID, a prefix, a suffix, and a namespace ID. Namespace ID is the syntactic structure ID of the namespace statement in the statement table. The source file ID corresponds to the parent syntax structure ID in the class declaration table.
And then adding the parameters of the class declaration statement public class Democlass in the statement table. Since the class declaration statement public class Democlass has no argument, it does not have to be processed. Assuming that the class declaration statement contains the argument int a, a data line is added in the statement table. The statement type is String, the father grammar structure ID is the class ID of Democlass, the timestamp and the value is int a, and the grammar structure ID is automatically distributed by a database. If the class declaration statement includes multiple arguments, multiple data rows are added to the statement table.
And then carrying out the datamation of the modular grammar structure of the ComplexStructure function, firstly adding a statement public void ComplexStruct into a statement table, wherein the statement type is public void, the grammar structure ID is automatically distributed by a database, and the parent grammar structure ID is the class ID of Democlass, the timestamp and the value are ComplexStruct. The statement type is public void, namely the statement indicates the data behavior is a function declaration statement, function declaration information is recorded, the syntax structure name of the function declaration information is recorded by the column of statement table values, and the function type is recorded by the statement type. The statement type is public void, which indicates that the statement may have parameters and must have a function body. The ComplexStructure function has no parameter, and the processing of the parameter is not performed, but the processing directly proceeds to the processing of the function body. The function body includes 1 syntax structure, i.e., for loop syntax structure.
Adding a piece of data in a statement table for the for function, wherein the statement type is for, the grammar structure ID is automatically allocated by a database, the father grammar structure ID is the grammar structure ID of the complexStructure, the time stamp and the value are null. And then sequentially adding 1 data row with the type of string in the statement table, and recording the statement int i =1. Adding statement i <10 in the dual operand expression table and adding statement i + +, in the expression table. The columns of the expression table include at least an expression type, an expression ID, a parent syntax structure ID, a value, and a timestamp. The columns of the dual operand expression table include at least a dual operand expression type, a dual operand expression ID, a parent syntax structure ID, a left expression ID, a right expression ID, and a timestamp. The expression information includes an expression type, an expression ID, a parent syntax structure ID, and an expression name. The expression name corresponds to the column of values of the expression table. The dual operand expression information includes a dual operand expression type, a dual operand expression ID, a parent syntax structure ID, a left expression ID, and a right expression ID.
The data added to the two operand expression table by statement i <10 is: the type of the double-operand expression is '<', the ID of the double-operand expression is automatically allocated by a database, the ID of a parent syntactic structure is a syntactic structure ID of a for statement, and the timestamp is a system timestamp. Then, two data rows are added to the expression table, and expressions i and 10 are recorded, respectively, wherein the data behavior of the expression i is as follows: the expression type is null, the expression ID is automatically allocated by the database, the father syntax structure ID is the syntax structure ID obtained when the statement i <10 is added to the double-operand expression table, the value is i, and the timestamp is the system timestamp. Data behavior of expression 10: the expression type is null, the expression ID is automatically allocated by the database, the parent syntax structure ID is the syntax structure ID obtained when the statement i <10 is added to the dual-operand expression table, the value is 10, and the timestamp is the system timestamp. And then, respectively writing the grammar structure IDs obtained by the expression i and the expression 10 into the left expression ID and the right expression ID of the statement i <10 in the double-operand expression table, and finishing the datamation of the statement i < 10. And then adding a data behavior of a statement i + + in the expression table: the expression type is + +, the expression ID is automatically distributed by the database, the father syntax structure ID is the syntax structure ID obtained when the statement i <10 is added to the double-operand expression table, the value is i, and the timestamp is the system timestamp.
The function body of the for function is then processed, and data is added to the variable declaration table for int forVar = 0 and int j = 10, respectively. The columns of the variable table include at least a variable name, a variable ID, a parent syntax structure ID, a variable type, a value, and a timestamp. The variable declaration information includes a variable name, a variable ID, a parent syntax structure ID, a variable type, and a variable initial value. The initial value of the variable corresponds to the value of the strain table. If the column of values is empty, only variables are declared and no assignment is made. After the statement int forVar = 0 is added to the variable declaration table, the corresponding data is: the variable name forVar and the variable ID are distributed by a database, the father syntax structure ID is the syntax structure ID of the for function, the variable type is int, the value is 0, and the timestamp is a system timestamp. Add statement int j = 10 to the variable declaration table accordingly.
And then processes the while loop syntax structure. And (2) taking a grammar structure storage table corresponding to the while loop grammar structure as a statement table, and firstly adding data behaviors in the statement table: the statement type is while, the grammar structure ID is automatically allocated by the database, the father grammar structure ID is the grammar structure ID of the for function, the time stamp is the system time stamp, and the value is null. Then adding a statement j >0 in a double-operand expression table, wherein the parent syntax structure ID of the double-operand expression j >0 is the syntax structure ID of while. The syntax structure ID for the dual operand expression j >0 is written back to the value of while, or not. When the grammar structure ID of which the parent grammar structure ID is while is inquired from the dual-operand expression table, the corresponding statement can be found. while's loop body consists of two statements: forVar + = j and j- -. The syntax structure storage tables corresponding to forVar + = j and j-are a two-operand expression table and an expression table, respectively, and both statements record the syntax structure ID of while as a parent syntax structure ID in the syntax structure storage table.
After all the codes are subjected to datamation, all variables used by the source file are enumerated, all the variables are added into the name space member table, and statistics and code checking are facilitated. The columns of the namespace member table include at least a grammar structure ID, a member type, a parent grammar structure ID, a member namespace ID, a source file ID where it is located, a value, and a timestamp. And automatically distributing the syntactic structure ID by a database, wherein the member type is a variable type, the member namespace ID is a namespace ID used by the source file, and the father syntactic structure ID is a father syntactic structure ID of a statement where the variable is located. The named member information includes a member ID, a member type, a member name, and a parent syntax structure ID. The member ID corresponds to the syntactic structure ID of the namespace member table, and the member name corresponds to the value of the namespace member table.
The restoration process of the source code is as follows:
firstly, according to the function requirement of the new project, obtaining the corresponding template project, and finding the corresponding source file ID according to the project name of the source file table. Assuming that the source file found is damo.cs, the source file ID of damo.cs is obtained first. Looking up a namespace table, a class declaration table and a statement table, finding all subdata of a source file ID with a father syntax structure ID of damo.
When the first using statement is restored, firstly restoring using, then looking up the statement table, and obtaining the subdata, namely the System, which takes the grammar structure ID of the first using as the father grammar structure ID, thereby restoring the first source code using the System.
And then according to the subdata recorded by the name space table: the syntactic structure ID is automatically assigned by the database, the parent syntactic structure ID is the source file ID of the source file damo. Restoring the namespace source code to namespace Demo { }.
And then according to the subdata recorded in the class statement table: the class name is Democlass, the class ID is automatically distributed by a database, the father syntax structure ID is the source file ID of the source file Damo. And recovering the class declaration source code public class Democlass { }. Because namespace Demo { } and public class DemoClass { } have a fixed nesting relationship, the code can be directly recovered:
namespace Demo
{
public class DemoClass
{
…
}
}
cs no longer have child data. Cs 7 child data of source file damo.cs: of the 5 using statements, the namespace statements and the class declaration statements, only the class declaration statements can query the next-level subdata in the database. Therefore, by using the class ID query statement table, the expression table, the dual-operand expression table and the variable declaration table of Democlass, the subdata can be found as follows: in the statement table, the data row corresponding to the ComplexStructure function is found. Namely: statement type is public void, syntax structure ID is automatically assigned by the database, parent syntax structure ID is class ID of Democlass, timestamp, and value is ComplexStructure. And recovering the source code as public void complete () }.
The parameters of the class declaration and the function declaration are recorded in a statement table, an expression table and a two-operand expression table, and the parameters are only recorded in a string form in the statement table. Therefore, the confusion of the statements corresponding to the parameters, the class structure bodies and the codes in the function bodies and the parameter codes can be avoided. Looking up the expression table and the two-operand expression table, no record with the syntactic structure ID of ComplexStructure as the parent syntactic structure ID can be found. A for statement will be found in the statement table. The for statement cannot be a argument of the function complexStructure and therefore can only be code within the function body of the function complexStructure. It is easy to know that the function body of the function ComplexStructure has only for statements. According to the record of the for statement in the database: statement type for, syntax structure ID assigned automatically by database, parent syntax structure ID ComplexStructure syntax structure ID, timestamp, and value null. And then querying a statement table, an expression table and a double-operand expression table, finding child data taking the syntactic structure ID of the for statement as a parent syntactic structure ID, querying 1 data row with the type of string in the statement table, and restoring a source code int i =1. The record of statement i <10 is inquired in the two-operand expression table, and the record of statement i + + is inquired in the expression table. After corresponding restoration, the source code for (int i =1; i <10; i + +) { }canbe restored. Data lines corresponding to int forVar = 0 and int j = 10 are also found in the variable declaration table, and data lines corresponding to while statements are found in the statement table.
Data behavior corresponding to while statement: the statement type is while, the grammar structure ID is automatically allocated by the database, the father grammar structure ID is the grammar structure ID of the for function, the time stamp is the system time stamp, and the value is null. A record is found in the two-operand expression table for statement j > 0. And further restores the source code while (j > 0) { }. Looking up the statement table, the expression table and the dual-operand expression table, taking the syntax structure ID of while as the data row of the parent syntax structure ID, respectively finding the data row corresponding to the statements forVar + = j and j-in the dual-operand expression table and the expression table, and then respectively restoring the source codes for forVar + = j and j-. The front-to-back order of the source code forVar + = j and j-is determined by the time stamp. The source code that then recovers the complete while loop syntax structure is while (j > 0) { forsar + = j; - }. And then, recovering the source code of a complete for loop syntax structure, wherein the recovery of all the source code of the source file damo.
The source file information comprises a source file name and a template engineering name, and the most basic effect of recovering the source file can be realized. If the information contained in the source file information is increased, such as the content of the creator, the creation time, the total number of functions, the number of code lines, and the like, the operation available for information processing can be increased. The namespace table records all namespace information contained in the template project, the namespace information comprises names of the namespaces, and members contained in the namespaces are recorded by the namespace member table. The most basic technical effect of restoring the name space can be realized by combining the two.
An automatic source code generating device based on code datamation executes the automatic source code generating method based on code datamation, please refer to fig. 5, and comprises a template engineering input module 10, a code datamation module 20, a new engineering establishing module 30 and a code recovery module 40, wherein the template engineering input module 10 receives a plurality of template engineering and corresponding function descriptions, the code datamation module 20 establishes a plurality of syntax structure storage tables in a database, the source codes of the template engineering are stored in a relational database, the new engineering establishing module 30 establishes a new engineering according to the new engineering name submitted by a user and the selected template engineering name, and forwards the corresponding template engineering name to the code recovery module 40, and the code recovery module 40 reads and recovers the source codes of the corresponding template engineering name from the relational database.
When the code datamation module 20 stores the source code of the template project in the relational database, the following steps are executed: establishing a plurality of grammar structure storage tables in a database, wherein each grammar structure corresponds to one grammar structure storage table; the column structure of the grammar structure storage table corresponds to parameters of a grammar structure, the column of the grammar structure storage table also comprises a grammar structure ID and a father grammar structure ID, the grammar structure of the template engineering is read in sequence, grammar structure records are added in the corresponding grammar structure storage table to obtain the grammar structure ID, and if the grammar structure has the father grammar structure, the father grammar structure ID is filled; after all the template projects are added to the database, the datamation of the codes is completed; according to the functional requirements of the new project, a corresponding source file data table is found, a database is inquired, each piece of data of the source file is traversed recursively in sequence, all subdata of the current source file table is found, a tree structure is built for the source file data and the subdata, restoration of a source code is completed by utilizing a serialized file of each tree structure, and then automatic generation of the source code of the new project is completed.
The beneficial technical effects of the embodiment include: the source code is converted into a structure which can be stored in a relational database, so that the relational structure of the code is effectively established, the code can be processed by a plurality of data processing methods, and a more complex and more automatic code management and generation mode is realized; the template engineering is provided, so that the engineering code needing to be repeatedly developed can be completed by only developing once and then developing a small amount of codes, the development efficiency of the codes is effectively improved, and the development of software technology is promoted.
The second embodiment:
compared with the first embodiment, the embodiment provides a code datamation scheme capable of supporting more complex functions.
In the first embodiment, the source file table, the namespace member table, the class declaration table, the statement table, the expression table, the dual-operand expression table, and the variable declaration table only record the most basic information, and only can realize restoration of codes and cannot support more complex data processing operations.
Compared with the first embodiment, the structure of the source file table, the namespace table and the variable declaration table in the embodiment is specifically improved.
Table 1 source file table structure
As shown in table 1, the field structure and field description of the more complete source file table provided in this embodiment have 13 fields in total, and the structure of the source file table is recorded comprehensively, so that richer data processing and analysis work can be supported, for example, code workload can be audited and examined for a creator.
TABLE 2 namespace Table Structure
As shown in table 2, statistical information such as the number of class statements, the number of enumeration statements, the number of delegation statements, the number of interface statements, and the like is provided for the namespace table structure, so that audit work is facilitated. By recording the line number of the file, the column number of the file and the main key of the file, the source code can be recovered more quickly.
Table 3 variable declaration table structure
As shown in table 3, for the variable declaration table structure, the types of the upper level syntax structures of the variable declaration statements are various, and the upper level type may not be distinguished as in the first embodiment, or the parent syntax structure ID of the expression may be determined according to the upper level type as provided in this embodiment. In this embodiment, the expression parent syntax structure ID is one of a superior branch ID, a located file ID, a superior structure class member ID, a superior interface ID, or a superior syntax structure ID. The declaration type of the variable declaration statement, the line number of the file, the column number of the file and the level data are provided, and the restoration of the source code can be accelerated. The statement corresponding to the attribute list ID and the modifier list ID can be obtained by combining the statement table, and the correct and complete restoration of the source code is realized.
Part of the statements of the source file as in the template project are as follows.
public void ComplexStructure(){
for(int i=1;i<10;i++){
int forVar=0;
int j=10;
while(j>0){int whileVar=1;if(j>5){intifVar=2;}else{intelseVar=2;}j--;}
}
}
The statement "public void complete ()" will be the parent statement, i.e. the parent syntactic structure, of the rest of the statements. In the embodiment, the structural meanings of the parent sentence and the parent grammar are identical. If the statement "public void complete ()" has no parent statement, it is determined that the parent syntax structure ID of the statement is the source file ID, and when restoring the source file of the corresponding ID, the statement "public void complete ()" can be found from the source file ID.
The statement "public void complete ()" includes a variable declaration statement, a for statement, and a while statement. The for statement and the while statement are respectively stored in a statement table, the corresponding statement types are the for type and the while type, and the variable declaration statement and the variables used by the for statement and the while statement are stored in the variable declaration table. As shown in table 4, after the variables are added to the variable declaration table in the database, the values of some columns are shown in the table. The data recorded in the variable declaration table is combined with the data stored in other tables to restore the complete source code.
Table 4 values of partial columns of variable declaration table
Compared with the first embodiment, the embodiment provides a more detailed and rich database table structure, which is used for digitizing the source code and providing more rich operations, such as code amount auditing, comparison and other works. The functions of the datamation codes when the new engineering source codes are generated are further enriched, and the quality of the new engineering source codes is improved.
While the invention has been described with reference to specific embodiments thereof, it will be understood by those skilled in the art that the invention is not limited thereto, and may be embodied in many different forms without departing from the spirit and scope of the invention as set forth in the following claims. Any modification which does not depart from the functional and structural principles of the present invention is intended to be included within the scope of the claims.
Claims (5)
1. A source code automatic generation method based on code datamation is characterized by comprising the following steps:
acquiring a plurality of template projects, and adding function descriptions of the template projects;
establishing a plurality of grammar structure storage tables in a database, wherein each grammar structure corresponds to one grammar structure storage table, the column structure of the grammar structure storage tables corresponds to the parameters of the grammar structure, and the columns of the grammar structure storage tables also comprise grammar structure IDs and father grammar structure IDs;
sequentially reading the grammar structures of the template engineering, adding sentence records in corresponding grammar structure storage tables to obtain grammar structure IDs, and filling in the father grammar structure IDs if the grammar structures have father grammar structures;
after all the template projects are added to the database, the datamation of the codes is completed;
reading a source file table from a database, querying the database, and finding all source file data required by a new project;
sequentially recursively traversing each source file data to find all subdata of the current source file data;
completing restoration of the source code according to the source file data and the corresponding subdata, namely completing automatic generation of the source code of the new project;
the grammar structure storage table comprises a source file table, a name space member table, a class declaration table, a statement table, an expression table, a double-operand expression table and a variable declaration table, wherein the source file table records source file information contained in a template project, the source file information comprises a source file name and a template project name, the name space table records all name space information contained in the template project, the name space member table records a plurality of name member information of the template project, the class declaration table records class declaration information contained in the template project, the statement table records statement information contained in the template project, the expression table records expression information contained in the template project, the double-operand expression table records double-operand expression information contained in the template project, and the variable declaration table records variable declaration information used by the template project;
the method for adding the grammar structure record in the corresponding grammar structure storage table comprises the following steps:
reading a project name of a template project, wherein the project name comprises a project file name and a solution name;
traversing each source file under the template engineering, and adding source file information in a source file table, wherein the source file information comprises an engineering name, a source file ID and a namespace ID;
establishing a syntax tree of a source file;
traversing the access syntax tree, and executing the following steps:
reading a currently accessed grammar node, and judging the type of the grammar node;
if the statement is a class declaration statement, adding class declaration information in a class declaration table, wherein the class declaration information comprises a class name, a namespace ID, a class ID, a prefix, a suffix and a source file ID to which the class declaration information belongs;
if the statement is a function statement, adding function statement information in a statement table, wherein the function statement information comprises a function type, a grammar structure name, a grammar structure ID and a father grammar structure ID;
if the syntax structure is a single-operand expression syntax structure, adding expression information in an expression table, wherein the expression information comprises an expression type, an expression ID and a father syntax structure ID;
if the expression is of a double-operand expression syntactic structure, adding double-operand expression information in a double-operand expression table, wherein the double-operand expression information comprises an expression type, an expression ID, a father syntactic structure ID and an expression name;
if the statement is a variable declaration statement, adding variable declaration information in a variable declaration table, wherein the variable declaration information comprises a variable name, a variable type, a variable initial value, a variable ID, a father syntax structure ID and a namespace ID;
the method for restoring the source code of the source file comprises the following steps:
finding a corresponding template project according to the functional requirements of the new project, and inquiring a database according to the name of the corresponding template project to obtain all matched source file information and corresponding source file IDs;
reading a source file table from a database, inquiring the database, and finding out all source file data required by a new project;
sequentially recursively traversing each source file data to find all subdata of the current source file data;
building tree structures for the source file data and the subdata, and generating statement codes according to the serialized files of each tree structure;
filling the subdata and the corresponding variable into the statement code according to the corresponding subdata, and completing restoration of a source code of the subdata;
and (4) completing restoration of the source code by all the subdata, namely completing automatic generation of the source code of the new project.
2. The method for automatically generating source code based on code datamation of claim 1,
the method for obtaining the namespace ID of the class declaration information comprises the following steps: and acquiring the name space name used by the class, inquiring the name space ID of the corresponding name space in the name space table, and if the corresponding name space does not exist, adding the name space in the name space table to acquire the corresponding name space ID.
3. The method for automatically generating source code based on code digitization as claimed in claim 1 or 2,
after a syntax tree of a source file is established, accessing a root node of the syntax tree to generate a member object of a namespace;
when traversing the syntax tree and traversing a class statement syntax structure, establishing a temporary table and recording a class ID and a naming space ID used by the class;
after traversing the syntax tree, updating a name space member table according to the temporary table, and adding name space member information of the name space member object in the name space member table, wherein the name space member information comprises a name space ID, a class ID and a source file ID.
4. An automatic source code generation device based on code digitization according to any one of claims 1 to 3, wherein the automatic source code generation device is used for executing a method for automatically generating source code based on code digitization,
the system comprises a template engineering input module, a code datamation module, a new engineering establishment module and a code recovery module, wherein the template engineering input module receives a plurality of template engineering and corresponding function descriptions, the code datamation module establishes a plurality of grammar structure storage tables in a database and stores source codes of the template engineering in a relational database, the new engineering establishment module establishes a new engineering according to a new engineering name submitted by a user and a selected template engineering name and forwards the corresponding template engineering name to the code recovery module, and the code recovery module reads and recovers the source codes of the corresponding template engineering name from the relational database.
5. The apparatus for automatically generating source code based on code digitization as claimed in claim 4,
when the code datamation module stores the source code of the template engineering in the relational database, the following steps are executed: establishing a plurality of grammar structure storage tables in a database, wherein each grammar structure corresponds to one grammar structure storage table; the column structure of the grammar structure storage table corresponds to parameters of a grammar structure, the column of the grammar structure storage table also comprises a grammar structure ID and a father grammar structure ID, the grammar structure of the template engineering is read in sequence, grammar structure records are added in the corresponding grammar structure storage table to obtain the grammar structure ID, and if the grammar structure has the father grammar structure, the father grammar structure ID is filled; after all the template projects are added to the database, the datamation of the codes is completed; according to the functional requirements of the new project, a corresponding source file data table is found, a database is inquired, each piece of data of the source file is traversed recursively in sequence, all subdata of the current source file table is found, a tree structure is built for the source file data and the subdata, restoration of a source code is completed by utilizing a serialized file of each tree structure, and then automatic generation of the source code of the new project is completed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211092259.4A CN115167834B (en) | 2022-09-08 | 2022-09-08 | Automatic source code generation method and device based on code datamation |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211092259.4A CN115167834B (en) | 2022-09-08 | 2022-09-08 | Automatic source code generation method and device based on code datamation |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115167834A CN115167834A (en) | 2022-10-11 |
CN115167834B true CN115167834B (en) | 2022-12-23 |
Family
ID=83481837
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211092259.4A Active CN115167834B (en) | 2022-09-08 | 2022-09-08 | Automatic source code generation method and device based on code datamation |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115167834B (en) |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101017458A (en) * | 2007-03-02 | 2007-08-15 | 北京邮电大学 | Software safety code analyzer based on static analysis of source code and testing method therefor |
CN101488086A (en) * | 2008-12-23 | 2009-07-22 | 北京中企开源信息技术有限公司 | Software generation method and apparatus based on field model |
CN101650651A (en) * | 2009-09-17 | 2010-02-17 | 浙江大学 | Visualizing method of source code level program structure |
CN101826014A (en) * | 2010-04-20 | 2010-09-08 | 北京邮电大学 | Dividing method of source code in software engineering |
JP2013257639A (en) * | 2012-06-11 | 2013-12-26 | Ntt Data Corp | Method and system of difference extraction of source code using syntax analysis |
CN104391730A (en) * | 2014-08-03 | 2015-03-04 | 浙江网新恒天软件有限公司 | Software source code language translation system and method |
JP2016201009A (en) * | 2015-04-13 | 2016-12-01 | 三菱電機株式会社 | Source code generation system, source code generation apparatus, source code generation method, and program |
CN109739526A (en) * | 2017-10-30 | 2019-05-10 | 北京京东尚科信息技术有限公司 | Code update method and device |
CN112860248A (en) * | 2019-11-27 | 2021-05-28 | 中盈优创资讯科技有限公司 | Source code generation method and device |
CN112925563A (en) * | 2021-02-24 | 2021-06-08 | 南通大学 | Code reuse-oriented source code recommendation method |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060253273A1 (en) * | 2004-11-08 | 2006-11-09 | Ronen Feldman | Information extraction using a trainable grammar |
WO2017134665A1 (en) * | 2016-02-03 | 2017-08-10 | Cocycles | System for organizing, functionality indexing and constructing of a source code search engine and method thereof |
CN109033843B (en) * | 2018-08-02 | 2022-06-10 | 南瑞集团有限公司 | Java file dependency analysis method and module for distributed static detection system |
US11068244B2 (en) * | 2019-10-01 | 2021-07-20 | Salesforce.Com, Inc. | Optimized transpilation |
WO2021087648A1 (en) * | 2019-11-04 | 2021-05-14 | Merico, Inc. | Systems and methods for evaluating code contributions by software developers |
-
2022
- 2022-09-08 CN CN202211092259.4A patent/CN115167834B/en active Active
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101017458A (en) * | 2007-03-02 | 2007-08-15 | 北京邮电大学 | Software safety code analyzer based on static analysis of source code and testing method therefor |
CN101488086A (en) * | 2008-12-23 | 2009-07-22 | 北京中企开源信息技术有限公司 | Software generation method and apparatus based on field model |
CN101650651A (en) * | 2009-09-17 | 2010-02-17 | 浙江大学 | Visualizing method of source code level program structure |
CN101826014A (en) * | 2010-04-20 | 2010-09-08 | 北京邮电大学 | Dividing method of source code in software engineering |
JP2013257639A (en) * | 2012-06-11 | 2013-12-26 | Ntt Data Corp | Method and system of difference extraction of source code using syntax analysis |
CN104391730A (en) * | 2014-08-03 | 2015-03-04 | 浙江网新恒天软件有限公司 | Software source code language translation system and method |
JP2016201009A (en) * | 2015-04-13 | 2016-12-01 | 三菱電機株式会社 | Source code generation system, source code generation apparatus, source code generation method, and program |
CN109739526A (en) * | 2017-10-30 | 2019-05-10 | 北京京东尚科信息技术有限公司 | Code update method and device |
CN112860248A (en) * | 2019-11-27 | 2021-05-28 | 中盈优创资讯科技有限公司 | Source code generation method and device |
CN112925563A (en) * | 2021-02-24 | 2021-06-08 | 南通大学 | Code reuse-oriented source code recommendation method |
Non-Patent Citations (2)
Title |
---|
一个源代码自动生成工具的设计与实现;富彧;《电脑知识与技术》;20070908;第2007年卷(第17期);第1321-1322页 * |
基于语法结构的源代码搜索的研究;黄丽韶;《电脑与电信》;20130510(第05期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN115167834A (en) | 2022-10-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107958057B (en) | Code generation method and device for data migration in heterogeneous database | |
US9830341B2 (en) | Resource name generation and derivation utilizing attribute space monikers and their associated context | |
CN112463149B (en) | Software-defined satellite-oriented reusable code library construction method and device | |
CN111367975B (en) | Multi-protocol data conversion processing method and device | |
CN104035754A (en) | XML (Extensible Markup Language)-based custom code generation method and generator | |
CN101788994A (en) | Method for constructing data display model and method and device for displaying data | |
CN112949276A (en) | Report generation method and device, electronic equipment and storage medium | |
US9483508B1 (en) | Omega names: name generation and derivation | |
CN110019111B (en) | Data processing method, data processing device, storage medium and processor | |
CN113448562B (en) | Automatic logic code generation method and device and electronic equipment | |
CN110334326A (en) | A kind of method and system for identifying recipe file and being converted into XML file | |
CN108664546B (en) | XML data structure conversion method and device | |
JP2013533564A (en) | Synchronized linkage method and system between engineering analysis programs using databased shared memory | |
CN100527131C (en) | Interdynamic access method and tool of IMS data base | |
CN115167834B (en) | Automatic source code generation method and device based on code datamation | |
US20050137846A1 (en) | On-demand creation of Java locale source | |
CN113536041A (en) | Method for rapidly acquiring railway engineering geographic information metadata in batches | |
CN113971044A (en) | Component document generation method, device, equipment and readable storage medium | |
CN113988003A (en) | Method for custom directional analysis of multiple sheet contents of Excel file according to specified configuration | |
CN109240672B (en) | Artificial intelligence writing method for information transmission source code of single machine component of digital aircraft | |
CN116627390B (en) | ICD file substitution method and device in aviation software development | |
CN113792048B (en) | Form verification rule generation method and system for non-relational database | |
JPWO2017221364A1 (en) | Adapter generation apparatus and method | |
CN114818612A (en) | Report code processing method based on structured data and related equipment | |
CN115952305A (en) | Fusion method and device of information, computing equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |