Pseudo-code-based source code generation method and device, computer equipment and readable storage medium
By matching pseudo-code instructions and obtaining natural language logic parameters in the pseudo-code editing interface, and generating source code using preset method models, the problem of low efficiency in standard syntax writing is solved, and efficient source code generation is achieved.
Patent Information
- Application Number
- CN202411337904.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2025-01-03
AI Technical Summary
In the prior art, when writing and compiling code based on standard syntax, the complex syntax rules lead to low source code generation efficiency.
Using a pseudo-code-based method, the characters to be matched through the pseudo-code editing interface are obtained, candidate preset pseudo-code instructions are matched, natural language logic parameters are obtained, and source code is generated using the preset method model to improve code generation efficiency.
Generating source code through the pseudo-code editing interface improves the efficiency of code generation, implements standardized, executable and easy-to-maintain pseudo-code writing, and supports the conversion of pseudo-code to real programming languages.
Smart Images

Figure CN119248235A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a source code generation method, apparatus, computer equipment, computer-readable storage medium, and computer program product based on pseudocode. Background Art
[0002] With the development of computer technology, the generation of specific programs needs to be achieved through code writing and compilation during program development. That is, program development needs to be carried out through code writing. At present, in the process of program development, code writing is usually carried out by writing the code according to the standard syntax of the program language and then compiling it to obtain the corresponding program. However, when writing and compiling the code based on the standard syntax, the grammar rules are relatively complicated, and the code needs to be verified many times, which leads to a decrease in the efficiency of source code generation.
[0003] Therefore, the current source code generation method has the defect of low efficiency. Summary of the invention
[0004] Based on this, it is necessary to provide a pseudocode-based source code generation method, apparatus, computer device, computer-readable storage medium and computer program product that can improve generation efficiency in response to the above technical problems.
[0005] In a first aspect, the present application provides a source code generation method based on pseudocode, the method comprising:
[0006] When it is detected that the pseudocode editing interface is started, the characters to be matched input in the pseudocode editing interface are obtained;
[0007] Acquire each candidate preset pseudocode instruction matching the character, and when a selection instruction for each target preset pseudocode instruction in each candidate preset pseudocode instruction is detected, generate each preset pseudocode statement corresponding to each target preset pseudocode instruction in the pseudocode editing interface;
[0008] Acquire each natural language logic parameter input based on each grammatical information of each preset pseudo code sentence;
[0009] The preset method models corresponding to the preset pseudo code statements are obtained, and the source codes corresponding to the preset pseudo code statements are generated according to the natural language logic parameters and the preset method models.
[0010] In one embodiment, the step of obtaining each candidate preset pseudocode instruction matching the character includes:
[0011] Matching the character with the instruction name of each preset pseudocode instruction to obtain each candidate preset pseudocode instruction whose instruction name contains the character;
[0012] Each of the candidate preset pseudocode instructions is displayed in the pseudocode editing interface.
[0013] In one of the embodiments, the target preset pseudo code instruction is one of a method call instruction, a service call instruction, a logic description instruction, a conditional instruction, and a code block instruction;
[0014] The obtaining of each natural language logic parameter input based on each grammatical information of each preset pseudo code statement includes:
[0015] For each target preset pseudocode instruction, if the target preset pseudocode instruction is a method call instruction or a logic description instruction, a method name and an assignment statement input based on the grammatical information of the preset pseudocode statement are obtained as the natural language logic parameter;
[0016] and / or,
[0017] If the target preset pseudocode instruction is a service call instruction, obtaining a service name and an assignment statement input based on the grammatical information of the preset pseudocode statement as the natural language logic parameter;
[0018] and / or,
[0019] If the target preset pseudocode instruction is a conditional instruction, obtaining a judgment logic statement input based on the grammatical information of the preset pseudocode statement as the natural language logic parameter;
[0020] and / or,
[0021] If the target preset pseudocode instruction is a code block instruction, a code block input based on grammatical information of the preset pseudocode statement is obtained as the natural language logic parameter.
[0022] In one embodiment, generating source code corresponding to each of the preset pseudocode statements according to each of the natural language logic parameters and each of the preset method models includes:
[0023] Determine the graphics primitives corresponding to the preset pseudo-code statements according to the execution order corresponding to the preset pseudo-code statements;
[0024] Generate a corresponding process view according to each of the graphic elements;
[0025] Determine, according to the graphic element type corresponding to each graphic element, the mapping relationship between each natural language logic parameter corresponding to each graphic element and each preset method model;
[0026] For each graphic element in the process view, according to the mapping relationship, the natural language logic parameter corresponding to the graphic element is input into the corresponding preset method model to obtain the input preset method model;
[0027] The source code is generated according to the preset method model after each input corresponding to each of the graphic elements.
[0028] In one of the embodiments, the target preset pseudo code instruction is one of a method call instruction, a service call instruction, a logic description instruction, a conditional instruction, and a code block instruction;
[0029] Determining the graphics primitives corresponding to the preset pseudo-code statements according to the execution order corresponding to the preset pseudo-code statements includes:
[0030] For each preset pseudocode statement, if the target preset pseudocode instruction corresponding to the preset pseudocode statement is the method call instruction, the service call instruction, the logic description instruction or the code block instruction, then determining that the primitive corresponding to the preset pseudocode statement is a task primitive;
[0031] If the target preset pseudocode instruction corresponding to the preset pseudocode statement is the conditional instruction, it is determined that the primitive corresponding to the preset pseudocode statement is a control primitive.
[0032] In one embodiment, determining the mapping relationship between each natural language logic parameter corresponding to each graphic element and each preset method model according to the graphic element type corresponding to each graphic element includes:
[0033] For each of the primitives, if the primitive type corresponding to the primitive is a task primitive, determining that a mapping relationship between a natural language logic parameter corresponding to the primitive and the preset method model is a first mapping relationship;
[0034] If the primitive type corresponding to the primitive is a control primitive, it is determined that the mapping relationship between the natural language logic parameter corresponding to the primitive and the preset method model is a second mapping relationship.
[0035] In one embodiment, after generating source code corresponding to each of the preset pseudo code statements according to each of the natural language logic parameters and each of the preset method models, the method further includes:
[0036] Generate a code editing record according to each of the preset pseudo code statements, each of the natural language logic parameters, the source code and the generation time corresponding to the source code;
[0037] The code editing record is saved in a database.
[0038] In a second aspect, the present application provides a source code generation device based on pseudocode, the device comprising:
[0039] A first acquisition module is used to acquire the characters to be matched input in the pseudocode editing interface when detecting that the pseudocode editing interface is started;
[0040] A selection module is used to obtain each candidate preset pseudocode instruction matching the character, and when a selection instruction for each target preset pseudocode instruction in each candidate preset pseudocode instruction is detected, generate each preset pseudocode statement corresponding to each target preset pseudocode instruction in the pseudocode editing interface;
[0041] A second acquisition module is used to acquire each natural language logic parameter input based on each grammatical information of each preset pseudo code sentence;
[0042] A generation module is used to obtain each preset method model corresponding to each of the preset pseudo code statements, and generate source code corresponding to each of the preset pseudo code statements according to each of the natural language logic parameters and each of the preset method models.
[0043] In a third aspect, the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0044] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.
[0045] In a fifth aspect, the present application provides a computer program product, including a computer program, which implements the steps of the above method when executed by a processor.
[0046] The above-mentioned source code generation method, device, computer equipment, computer-readable storage medium and computer program product based on pseudocode obtain each candidate preset pseudocode instruction that matches the input characters, generate each preset pseudocode statement corresponding to each selected target preset pseudocode instruction in the pseudocode editing interface, obtain each natural language logic parameter input based on each grammatical information of the preset pseudocode statement, and generate corresponding source code according to each natural language logic parameter and each preset method model of each preset pseudocode statement. Compared with the traditional code editing based on standard programming language syntax, this scheme improves the efficiency of code generation by using pre-defined pseudocode instructions that conform to natural semantics in the pseudocode editing interface to determine the pseudocode statement, and generating source code through the preset method model corresponding to the statement combined with the input natural language logic parameter. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0048] FIG1 is a schematic flow chart of a source code generation method based on pseudocode in one embodiment;
[0049] FIG2 is a flow chart of a process view generation step in one embodiment;
[0050] FIG3 is a block diagram of a source code generation device based on pseudocode in one embodiment;
[0051] FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0052] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0053] In one embodiment, as shown in FIG1 , a source code generation method based on pseudocode is provided. This embodiment is described by taking the method applied to a terminal as an example. It is understandable that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server, including the following steps S202 to S208. Among them:
[0054] Step S202, when it is detected that the pseudo code editing interface is started, the characters to be matched input in the pseudo code editing interface are obtained.
[0055] Among them, in the process of managing the power grid, it is necessary to develop various types of program software to manage various businesses in the power grid. For example, developing green electricity subscription software to realize green electricity subscription business. The development of program software involves code writing. The terminal can be set up on the software design automation collaboration platform in the power grid. The software design automation collaboration platform uses digitalization to help the transformation of software development models. It is divided into conceptual model design, application service design, development architecture design and application detailed design. In the application detailed design, the terminal can express the simplified logic of the method by designing pseudo-code logic, without relying on specific programming language syntax, using natural language or similar programming language to write code, and then describe the program logic and develop the program.
[0056] Since the current pseudocode does not have strict syntax and specifications like some formal programming languages, the form of pseudocode may vary from person to person, resulting in ambiguity in understanding and communication between different developers. In addition, the current pseudocode is only a descriptive tool and cannot be run directly on a computer. Pseudocode is only a simplified version used to describe the logical relationship of the program and serves as an outline. In addition, due to the lack of strict specifications and version control mechanisms, confusion and inconsistencies may occur when modifying and updating the pseudocode. Therefore, this solution can realize the writing of standardized, executable and easy-to-maintain pseudocode by writing code in the terminal, as well as the conversion of pseudocode to the source code of a real programming language.
[0057] Among them, a pseudocode editing interface may be provided in the terminal, and the pseudocode editing interface may include a pseudocode view, and the pseudocode may represent the steps of the method through natural semantics and instructions. The terminal may detect whether an instruction to start the pseudocode editing interface is received, such as detecting whether a click operation on the pseudocode editing interface is received. When the terminal detects that the pseudocode editing interface is started, the pseudocode editing interface may be started, and the characters to be matched entered in the pseudocode editing interface may be obtained. Among them, multiple pseudocode instructions may be pre-set in the terminal, and the pseudocode instructions may carry corresponding names. Relevant developers may enter characters in the pseudocode editing interface, so that the terminal may query the existing preset pseudocode instructions based on the input characters, and match the preset pseudocode instructions.
[0058] Step S204, obtaining each candidate preset pseudocode instruction matching the above characters, and when detecting a selection instruction for each target preset pseudocode instruction in each of the above candidate preset pseudocode instructions, generating each preset pseudocode statement corresponding to each of the above target preset pseudocode instructions in the above pseudocode editing interface.
[0059] Among them, the terminal can query the names of the existing preset pseudocode instructions based on the input characters to be matched, and obtain the candidate preset pseudocode instructions whose names contain the above characters, so that the terminal can obtain the candidate preset pseudocode instructions that match the above characters, and the terminal can display the above-mentioned determined candidate preset pseudocode instructions in the above-mentioned pseudocode editing interface, and wait for the selection instructions for each candidate preset pseudocode instruction. If the terminal detects the selection instructions for each target preset pseudocode instruction in each candidate preset pseudocode instruction. For example, when the developer clicks on any number of displayed candidate preset pseudocode instructions in the above-mentioned pseudocode editing interface, when the terminal detects the click operation on any number of candidate preset pseudocode instructions, it is determined that the selection instructions for these candidate preset pseudocode instructions are detected, so that the terminal can obtain each target preset pseudocode instruction based on each candidate preset pseudocode instruction that is clicked.
[0060] Among them, each of the above preset pseudocode instructions can be associated with each corresponding preset pseudocode statement. The preset pseudocode statement can be a statement when displaying pseudocode in the pseudocode editing interface, which includes the name of the preset pseudocode instruction and the natural language logic parameters to be input in the preset pseudocode, so that the developer can input the corresponding natural language logic parameters in the preset pseudocode statement according to the syntax corresponding to the preset pseudocode to form the preset pseudocode. Then, after determining each target preset pseudocode instruction, the terminal can obtain each preset pseudocode statement corresponding to each target preset pseudocode instruction. The terminal can generate each preset pseudocode statement corresponding to each target preset pseudocode instruction in the pseudocode editing interface, and wait to receive the natural language logic parameters input by the developer for each preset pseudocode statement.
[0061] Step S206, obtaining each natural language logic parameter input based on each grammatical information of each of the above-mentioned preset pseudo code sentences.
[0062] Among them, the preset pseudocode statement can be a pseudocode statement corresponding to the target preset pseudocode instruction. The developer can input the corresponding natural language logic parameters according to the grammatical rules corresponding to the preset pseudocode statement, so that the terminal can obtain the various natural language logic parameters input based on the various grammatical information of each preset pseudocode statement. Among them, since each preset pseudocode statement corresponds to a different method, the grammatical information of each preset pseudocode statement can be different. The above-mentioned natural language logic parameters can be parameters that use natural language to describe the method logic corresponding to the pseudocode instruction. Each preset pseudocode statement may contain at least one input position of a natural language logic parameter. Thus, the terminal can use the natural language logic parameters in combination with the preset pseudocode statement to convert the source code of the real compiled language.
[0063] Step S208, obtaining each preset method model corresponding to each of the above preset pseudo code statements, and generating source code corresponding to each of the above preset pseudo code statements according to each of the above natural language logic parameters and each of the above preset method models.
[0064] The preset pseudocode instructions can be associated with corresponding preset pseudocode statements and preset method models, respectively. Then, there is a corresponding relationship between the preset pseudocode statements and the preset method models belonging to the same preset pseudocode instruction. The terminal can obtain the preset method models corresponding to the preset pseudocode statements, so that the terminal can generate source codes corresponding to the preset pseudocode statements according to the natural language logic parameters and the preset method models.
[0065] Among them, the preset method model can be a code model of a real programming language corresponding to a preset pseudocode statement. The preset method model includes code statements written in the real programming language according to the syntax of the corresponding programming language, including blank positions for entering parameters. Then, the terminal can analyze the above natural language logic parameters and convert them into parameters that conform to the grammatical rules of the above real programming language, and input the converted parameters into the code statements corresponding to the above preset method model to form each code corresponding to each preset pseudocode statement, so that the terminal can integrate the above codes to obtain integrated source code.
[0066] Among them, the terminal can analyze and convert the above natural language logic parameters through a deep learning neural network. For example, the terminal inputs the above natural language logic parameters and the corresponding preset method model into the deep learning neural network. The deep learning neural network analyzes the natural language logic parameters by combining the programming language and grammar rules of the preset method model, and after determining its specific meaning, it converts it into parameters of the corresponding programming language according to the above grammar rules and inputs it into the above preset method model. After the terminal determines the source code based on the above preset pseudocode statements, it can save the editing record.
[0067] In one embodiment, after generating source codes corresponding to each of the above-mentioned preset pseudocode statements according to each of the above-mentioned natural language logic parameters and each of the above-mentioned preset method models, it also includes: generating code editing records according to each of the above-mentioned preset pseudocode statements, each of the above-mentioned natural language logic parameters, the above-mentioned source code and the generation time corresponding to the above-mentioned source code; and saving the above-mentioned code editing records to a database.
[0068] In this embodiment, after the terminal completes the conversion of the source code, the editing and conversion process can be saved. For example, the terminal can obtain the above-mentioned preset pseudocode statements, each natural language logic parameter, source code, and the generation time of the source code, and generate a code editing record based on the above-mentioned preset pseudocode statements, each natural language logic parameter, source code, and the generation time of the source code, and save the above-mentioned code editing record to the database. Therefore, when the code version needs to be backtracked later, the terminal can query the corresponding version of the code editing record from the database based on character query and time query, and perform version recovery based on the queried code editing record.
[0069] Specifically, the terminal can also convert the above-mentioned preset pseudocode statements and corresponding natural language logic parameters into a process view, and the code editing record corresponding to the terminal can include the process view. The data of the same code editing record will be saved in a database, disk file and Git library for version control. The Git library can be a database of an open source distributed version control system. For example, after developer 1 logically arranges the above-mentioned preset pseudocode instructions and obtains the corresponding source code, developer 2 overwrites the editing results of developer 1. The terminal can find the code editing record corresponding to developer 1 from the saved code editing record, and perform version recovery to ensure that the editing results are not lost.
[0070] In the above-mentioned source code generation method based on pseudocode, by obtaining each candidate preset pseudocode instruction that matches the input characters, each preset pseudocode statement corresponding to each selected target preset pseudocode instruction is generated in the pseudocode editing interface, and each natural language logic parameter input based on each grammatical information of the preset pseudocode statement is obtained, and the corresponding source code is generated according to each natural language logic parameter and each preset method model of each preset pseudocode statement. Compared with the traditional code editing based on standard programming language syntax, this scheme improves the efficiency of code generation by using pre-defined pseudocode instructions that conform to natural semantics in the pseudocode editing interface to determine the pseudocode statement, and generating source code through the preset method model corresponding to the statement combined with the input natural language logic parameter.
[0071] In one embodiment, obtaining each candidate preset pseudocode instruction that matches the above-mentioned characters includes: matching the above-mentioned characters with the instruction names of each preset pseudocode instruction to obtain each candidate preset pseudocode instruction whose instruction name contains the above-mentioned characters; and displaying each of the above-mentioned candidate preset pseudocode instructions in the above-mentioned pseudocode editing interface.
[0072] In this embodiment, the terminal can obtain the characters to be matched input by the developer in the code editing interface, and use the above characters to match the preset pseudocode instructions. Among them, the terminal can match the above characters with the instruction names of each preset pseudocode instruction pre-configured in the terminal, so that the terminal can obtain each candidate preset pseudocode instruction whose instruction name contains the above characters. Among them, the instruction name of each candidate preset pseudocode instruction can contain the above characters.
[0073] After determining each candidate preset pseudocode instruction, the terminal can display each candidate preset pseudocode instruction. For example, the terminal generates a corresponding instruction list according to each candidate preset pseudocode instruction, and the terminal displays the instruction list in the pseudocode editing interface, thereby realizing the display of each candidate preset pseudocode instruction.
[0074] Through this embodiment, the terminal can query various pre-configured preset pseudocode instructions based on the characters input in the pseudocode editing interface, and then obtain various candidate preset pseudocode instructions for selection, thereby improving the efficiency of code editing and generation.
[0075] In one embodiment, obtaining each natural language logic parameter input based on each grammatical information of each preset pseudocode statement includes: for each target preset pseudocode instruction, if the target preset pseudocode instruction is a method call instruction or a logic description instruction, obtaining the method name and assignment statement input based on the grammatical information of the preset pseudocode statement as the natural language logic parameter. And / or, if the target preset pseudocode instruction is a service call instruction, obtaining the service name and assignment statement input based on the grammatical information of the preset pseudocode statement as the natural language logic parameter; and / or, if the target preset pseudocode instruction is a conditional instruction, obtaining the judgment logic statement input based on the grammatical information of the preset pseudocode statement as the natural language logic parameter; and / or, if the target preset pseudocode instruction is a code block instruction, obtaining the code block input based on the grammatical information of the preset pseudocode statement as the natural language logic parameter.
[0076] In this embodiment, the selected target preset pseudo code instruction is one of a method call instruction, a service call instruction, a logic description instruction, a conditional instruction, and a code block instruction. Then each target preset pseudo code instruction can be composed of the above instructions. For different types of target preset pseudo code instructions, the terminal can obtain different types of parameters input by the developer as natural language logic parameters.
[0077] Among them, for each target preset pseudocode instruction, the terminal can determine the type of natural language logic parameters to be input according to the type of the instruction. For example, if the terminal detects that the above target preset pseudocode instruction is a method call instruction or a logic description instruction, the parameters to be input for this instruction are the method name and the assignment statement. The terminal can obtain the method name and the assignment statement input based on the syntax information of the preset pseudocode statement corresponding to the target preset pseudocode instruction as the natural language logic parameters.
[0078] Specifically, the method call instruction can be represented as the @method instruction. Based on this instruction, the developer can select the class methods of the current project under the current microservice and the projects depended on by the current project. Its syntax composition (preset pseudocode statement) includes: "Logical description (optional) @method Name of the method to be called ((parameters are optional and can be variables or constants) Assignment statement (the variable can exist or not)". After the developer inputs the corresponding natural language logic parameters based on the above syntax information, the result can be: "@method this.delete(@var Query condition) @asbDelete : Return result of the delete method".
[0079] The logic description instruction can be represented as the @methodLogic instruction. Based on this instruction, the developer can add a new method in the current class for method description. Its syntax composition (preset pseudocode statement) includes: "Logical description (optional) @methodLogic Return value of the method (optional) Method name (required) (Parameters are optional) Assignment statement (the variable can exist or not)". After the developer inputs the corresponding natural language logic parameters based on the above syntax information, the result can be: "Annotation of methodLogic @methodLogic String query(@var Monkey) @asstrLoadMonkeyById : Monkey". It means that the terminal calls a newly created method, and the method can have input parameters and return values.
[0080] If the terminal detects that the above target preset pseudocode instruction is a service call instruction, the parameters to be input for this instruction are the service name and the assignment statement. The terminal can obtain the service name and the assignment statement input based on the syntax information of the preset pseudocode statement corresponding to the target preset pseudocode instruction as the natural language logic parameters.
[0081] Specifically, the service call instruction can be expressed as the @rest instruction, based on which developers can choose to call methods or interfaces under other microservices. Its grammatical composition (preset pseudocode statements) includes: "Logical description (optional) @rest service name ((parameters are optional, can be variables or constants) assignment statement (variables can exist or not exist)". After the developer enters the corresponding natural language logic parameters based on the above grammatical information, it can be obtained: "@rest detailed design microservice reads monkey records according to ID (service call parameters, can enter @ to multiple @asstrLoadMonkeyById: monkey (method return value)". It means calling methods of other microservices, and the input parameters can be entered from zero to multiple.
[0082] If the terminal detects that the above-mentioned target preset pseudocode instruction is a conditional instruction, the parameter required to be input for the instruction is a judgment logic statement. The terminal can obtain the judgment logic statement input based on the grammatical information of the preset pseudocode statement corresponding to the target preset pseudocode instruction as a natural language logic parameter.
[0083] Specifically, the conditional instruction can be expressed as the @cond instruction. Based on this instruction, developers can use it to make conditional judgments after if and use it in conjunction with if. Its grammatical composition (preset pseudocode statements) includes: "if user list is not null: @cond user list!=null". After the developer enters the corresponding natural language logic parameters based on the above grammatical information, it can get: "if @cond conditional statement / / logical judgment statement else / / logical judgment statement".
[0084] If the terminal detects that the above-mentioned target preset pseudocode instruction is a code block instruction, the parameter required to be input for the instruction is a code block. The terminal can obtain the code block input based on the grammatical information of the preset pseudocode statement corresponding to the target preset pseudocode instruction as a natural language logic parameter.
[0085] Specifically, the code block instruction can be represented as the @block instruction, based on which developers can write real code in the code block. Its grammatical composition (preset pseudocode statements) includes: "@block / / todo@endBlock". After the developer enters the corresponding natural language logic parameters based on the above grammatical information, it can get: "@block; String c = "c"; String d = "d"; @endBlock". It means that the real Java code is entered as the code block.
[0086] The above instructions also include variable instructions, variable declaration instructions, and assignment instructions. For variable instructions, the variable instruction can be expressed as @var instruction, which can be used to select member variables, method input parameters, and method local variables. Its grammatical composition (preset pseudocode statement) includes: "@var user list". The terminal can use this instruction as a method input parameter.
[0087] For variable declaration instructions, the variable declaration instruction can be expressed as @def instruction, which can be used to declare multiple variables at the same time. Its syntax composition (preset pseudo code statement) includes: "@def stringname="",List <userinfo>IstUserInfo". After the developer inputs the corresponding natural language logic parameters based on the above grammatical information, the result is: "@defStrings="s"". It means defining variables.
[0088] For the assignment instruction, the assignment instruction can be expressed as the @as instruction, which can be used to receive the return value of the variable. Its grammatical composition (preset pseudo code statement) includes: "@as strCreateExpandattributeValueOrg: organization extended attribute value".
[0089] Through the above embodiments, the terminal can input different natural languages as natural language logic parameters based on different pseudocode instructions, thereby realizing the generation of pseudocode. Then, the terminal can generate source code based on the method models corresponding to each natural language parameter and each pseudocode instruction, thereby improving the efficiency of code generation.
[0090] In one embodiment, source codes corresponding to the preset pseudocode statements are generated according to the natural language logic parameters and the preset method models, including: determining the graphics elements corresponding to the preset pseudocode statements according to the execution order of the preset pseudocode statements; generating corresponding process views according to the graphics elements; determining the mapping relationship between the natural language logic parameters corresponding to the graphics elements and the preset method models according to the graphics element types corresponding to the graphics elements; for each graphics element in the process view, inputting the natural language logic parameters corresponding to the graphics elements into the corresponding preset method models according to the mapping relationship to obtain the preset method models after input; generating the source codes according to the preset method models after input corresponding to the graphics elements.
[0091] In this embodiment, the above-mentioned code editing interface may also include a process view, and the process view may be converted from a pseudocode view. The terminal may convert the source code based on the above-mentioned preset pseudocode statements, or may convert the source code based on a flowchart. Wherein, when the terminal generates the source code corresponding to each of the above-mentioned preset pseudocode statements using the above-mentioned natural language logic parameters and the above-mentioned preset method models, for the step of converting the pseudocode into the source code, the terminal may convert it into the input parameter of the programming language corresponding to the preset method model based on the above-mentioned natural language logic parameters, so that the terminal inputs the above-mentioned converted input parameter into the corresponding position in the corresponding preset method model, and then obtains the input preset method model, wherein the preset method model may be a code block of a real programming language, then the terminal may obtain the source code corresponding to each preset pseudocode statement based on each code block in each preset method model in which the input parameter corresponding to the corresponding natural language logic parameter is input.
[0092] For the step of converting the process view into source code, the terminal can convert the pseudocode into the process view in advance. For example, the terminal can determine the execution order of each preset pseudocode statement based on the position of each preset pseudocode statement in the pseudocode editing interface and the logical relationship between each preset pseudocode instruction, so that the terminal can determine each graphic element corresponding to each of the above preset pseudocode statements according to the execution order corresponding to each of the above preset pseudocode statements. The terminal can generate a corresponding process view according to each of the above graphic elements, and determine the mapping relationship between each of the natural language logic parameters corresponding to each of the above graphic elements and each of the above preset method models according to the graphic element type corresponding to each of the above graphic elements.
[0093] There are multiple graphic elements in the above process view, and each graphic element has multiple types. For each graphic element in the above process view, the terminal can input the above natural language logic parameters corresponding to the above graphic element into the corresponding above preset method model according to the above mapping relationship, and obtain the above preset method model after input, so that the terminal can generate the above source code according to the above preset method models corresponding to each of the above graphic elements after input. The process view and the pseudocode view can be converted to each other, so that the terminal can realize conversion based on the process view to the source code, and can also realize conversion based on the pseudocode view to the source code.
[0094] Through this embodiment, the terminal can convert the pseudo code view into a process view, and convert the source code through relationship mapping based on each graphic element in the process view, thereby improving the efficiency of code generation.
[0095] In one embodiment, the graphics primitives corresponding to the above-mentioned preset pseudocode statements are determined according to the execution order corresponding to each of the above-mentioned preset pseudocode statements, including: for each preset pseudocode statement, if the target preset pseudocode instruction corresponding to the above-mentioned preset pseudocode statement is the above-mentioned method call instruction, the above-mentioned service call instruction, the above-mentioned logic description instruction or the above-mentioned code block instruction, then the graphics primitive corresponding to the above-mentioned preset pseudocode statement is determined to be a task graphics primitive; if the target preset pseudocode instruction corresponding to the above-mentioned preset pseudocode statement is the above-mentioned conditional instruction, then the graphics primitive corresponding to the above-mentioned preset pseudocode statement is determined to be a control graphics primitive.
[0096] In this embodiment, the above-mentioned target preset pseudocode instruction is one of a method call instruction, a service call instruction, a logic description instruction, a conditional instruction, and a code block instruction. Among them, different instructions correspond to different primitive types. When determining the primitives corresponding to each preset pseudocode statement, the terminal can determine the type based on the corresponding preset pseudocode instruction. For example, for each preset pseudocode statement, the terminal can obtain the target preset pseudocode instruction corresponding to the preset pseudocode statement, and detect the type of the target preset pseudocode instruction. Among them, if the terminal detects that the target preset pseudocode instruction corresponding to the preset pseudocode statement is a method call instruction, the above-mentioned service call instruction, the above-mentioned logic description instruction, or the above-mentioned code block instruction, the terminal can determine that the primitive corresponding to the above-mentioned preset pseudocode statement is a task primitive. If the terminal detects that the target preset pseudocode instruction corresponding to the above-mentioned preset pseudocode statement is the above-mentioned conditional instruction, the terminal can determine that the primitive corresponding to the above-mentioned preset pseudocode statement is a control primitive.
[0097] Among them, the task primitive indicates that the preset method model of the preset pseudocode statement corresponding to the primitive can be executed in the logical order of the code without judgment; the control primitive indicates that the preset method model of the preset pseudocode statement corresponding to the primitive is a conditional judgment type code, which requires conditional judgment to determine which part of the code to execute. For different types of primitives, the terminal can use different mapping relationships to associate natural language logic parameters and preset method models.
[0098] In one embodiment, according to the graphic element type corresponding to each of the above-mentioned graphic elements, the mapping relationship between each natural language logic parameter corresponding to each of the above-mentioned graphic elements and each of the above-mentioned preset method models is determined, including: for each of the above-mentioned graphic elements, if the graphic element type corresponding to the above-mentioned graphic element is a task graphic element, then the mapping relationship between the natural language logic parameter corresponding to the above-mentioned graphic element and the above-mentioned preset method model is determined to be a first mapping relationship; if the graphic element type corresponding to the above-mentioned graphic element is a control graphic element, then the mapping relationship between the natural language logic parameter corresponding to the above-mentioned graphic element and the above-mentioned preset method model is determined to be a second mapping relationship.
[0099] In this embodiment, the terminal can determine the mapping relationship between the natural language logic parameters and the preset method model based on the type of the graphic element. Wherein, if there are multiple graphic elements in the above process view, for each graphic element, the terminal can detect the type corresponding to the graphic element. If the terminal detects that the graphic element type corresponding to the graphic element is a task graphic element, the terminal can determine that the mapping relationship between the natural language logic parameters corresponding to the graphic element and the preset method model is a first mapping relationship. If the terminal detects that the graphic element type corresponding to the graphic element is a control graphic element, the terminal can determine that the mapping relationship between the natural language logic parameters corresponding to the graphic element and the preset method model is a second mapping relationship.
[0100] The first mapping relationship and the second mapping relationship can both represent the rule mapping of converting natural language logic parameters into code parameters of programming language and the rule mapping of the converted code parameters into the code block of the preset method model. The first mapping relationship and the second mapping relationship correspond to different rules.
[0101] Specifically, as shown in Figure 2, Figure 2 is a flow diagram of the process view generation step in an embodiment. The terminal can convert the pseudocode view containing each preset pseudocode statement into a process view, so that the method call can be intuitively seen through the process view, and the method can be edited by dragging and dropping. Among them, each graphic element in the process view represents each node, and the graphic element in the process view mainly includes task graphic element, control graphic source and event graphic element. Among them, the task graphic element is mainly composed of code block, java task, restfulapi, method logic task, and variable node, which correspond to @block, @method, @rest, @methodLogic and @var in the pseudocode view respectively, and the terminal can also edit the corresponding attributes in the attribute bar corresponding to each graphic element. Among them, the attributes include parameters such as node name, type, method name, return value, etc. For code blocks, it is equivalent to the code block instruction @block in the pseudocode; for Java tasks, it is equivalent to the method call instruction @method in the pseudocode; for restful APIs, it is equivalent to the service call instruction @rest in the pseudocode; for method logic tasks, it is equivalent to the logic description instruction @methodLogic in the pseudocode; for variable nodes, it is equivalent to the variable instruction @var in the pseudocode.
[0102] The control primitives include but are not limited to conditional branches, break controls, continue controls, for loop blocks, and while loop blocks. Among them, the conditional branch is used to control the execution flow of the program, for example, if the condition is met, then go to branch A, otherwise go to branch B; the break control is mainly used to terminate the most recent loop, such as for loops, while loops, etc.; the continue control is mainly used to skip the remaining code in the current loop iteration and enter the next loop; the for loop block is used to allow a section of code to be repeatedly executed until the condition is not met; the while loop block is used to allow a section of code to be repeatedly executed until the condition is not met. Thus, the terminal can map the natural language logic parameters to the preset method model based on the control primitives and in combination with the second mapping relationship. The event primitives may include start and end, etc., wherein the start represents the start node of the method in the process view; the end represents the end node of the method in the process view. The terminal can convert the above-mentioned process view or pseudocode view into code in a real programming language, for example, converting each primitive in the process view, or each preset pseudocode statement and natural language logic parameter in the pseudocode view into the source code of the java code, so that the code is executable.
[0103] Through the above-mentioned embodiments, the terminal can determine the type of each graphic element based on the type of pseudocode instructions corresponding to each graphic element in the process view, and then based on the type of each graphic element, use different mapping relationships to realize the conversion between the process view and the source code, so that the terminal can quickly represent the logical steps of the method through natural semantics and some customized instructions. Pseudocode can be used as a programming blueprint to guide developers to convert algorithms into specific program codes. By writing code first and then programming, the efficiency of code generation can be improved, and pseudocode can also be converted into real java code, which is convenient for developers to develop quickly. In addition, the pseudocode has an actual method model in the database, and version control is realized by dropping it on disk and submitting it to the git library. When different designers modify and update the same method, the consistency of design results is guaranteed.
[0104] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0105] Based on the same inventive concept, the embodiment of the present application also provides a pseudocode-based source code generation device for implementing the pseudocode-based source code generation method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more pseudocode-based source code generation device embodiments provided below can refer to the limitations of the pseudocode-based source code generation method above, and will not be repeated here.
[0106] In an exemplary embodiment, as shown in FIG3 , a source code generation device based on pseudocode is provided, comprising: a first acquisition module 500, a selection module 502, a second acquisition module 504 and a generation module 506, wherein:
[0107] The first acquisition module 500 is used to acquire the characters to be matched input in the pseudo-code editing interface when it is detected that the pseudo-code editing interface is started.
[0108] The selection module 502 is used to obtain each candidate preset pseudocode instruction matching the above-mentioned characters, and when a selection instruction for each target preset pseudocode instruction in each of the above-mentioned candidate preset pseudocode instructions is detected, each preset pseudocode statement corresponding to each of the above-mentioned target preset pseudocode instructions is generated in the above-mentioned pseudocode editing interface.
[0109] The second acquisition module 504 is used to acquire each natural language logic parameter input based on each grammatical information of each of the above-mentioned preset pseudo code sentences.
[0110] The generation module 506 is used to obtain each preset method model corresponding to each of the above preset pseudo code statements, and generate source code corresponding to each of the above preset pseudo code statements according to each of the above natural language logic parameters and each of the above preset method models.
[0111] In one embodiment, the selection module 502 is used to match the characters with the instruction names of each preset pseudocode instruction to obtain candidate preset pseudocode instructions whose instruction names contain the characters; and display each candidate preset pseudocode instruction in the pseudocode editing interface.
[0112] In one embodiment, the second acquisition module 504 is used to preset pseudocode instructions for each target. If the preset pseudocode instruction for the target is a method call instruction or a logic description instruction, the method name and assignment statement input based on the grammatical information of the preset pseudocode statement are obtained as the natural language logic parameter.
[0113] In one embodiment, the second acquisition module 504 is used to acquire the service name and assignment statement input based on the grammatical information of the preset pseudocode statement as the natural language logic parameter if the target preset pseudocode instruction is a service call instruction.
[0114] In one embodiment, the second acquisition module 504 is used to acquire a judgment logic statement input based on the grammatical information of the preset pseudocode statement as the natural language logic parameter if the target preset pseudocode instruction is a conditional instruction.
[0115] In one embodiment, the second acquisition module 504 is used to acquire a code block input based on the grammatical information of the preset pseudocode statement as the natural language logic parameter if the target preset pseudocode instruction is a code block instruction.
[0116] In one embodiment, the generation module 506 is used to determine the graphics elements corresponding to the preset pseudocode statements according to the execution order corresponding to the preset pseudocode statements; generate a corresponding process view according to the graphics elements; determine the mapping relationship between the natural language logic parameters corresponding to the graphics elements and the preset method models according to the graphics element types corresponding to the graphics elements; for each graphics element in the process view, input the natural language logic parameters corresponding to the graphics element into the corresponding preset method model according to the mapping relationship to obtain the input preset method model; generate the source code according to the input preset method models corresponding to the graphics elements.
[0117] In one embodiment, the generation module 506 is used to determine, for each preset pseudocode statement, that the graphic element corresponding to the preset pseudocode statement is a task graphic element if the target preset pseudocode instruction corresponding to the preset pseudocode statement is the method call instruction, the service call instruction, the logic description instruction or the code block instruction; if the target preset pseudocode instruction corresponding to the preset pseudocode statement is the conditional instruction, then the graphic element corresponding to the preset pseudocode statement is a control graphic element.
[0118] In one embodiment, the above-mentioned generation module 506 is used to, for each of the above-mentioned graphic elements, if the graphic element type corresponding to the above-mentioned graphic element is a task graphic element, determine that the mapping relationship between the natural language logic parameters corresponding to the above-mentioned graphic element and the above-mentioned preset method model is a first mapping relationship; if the graphic element type corresponding to the above-mentioned graphic element is a control graphic element, determine that the mapping relationship between the natural language logic parameters corresponding to the above-mentioned graphic element and the above-mentioned preset method model is a second mapping relationship.
[0119] In one embodiment, the above-mentioned device also includes: a saving module, which is used to generate a code editing record according to each of the above-mentioned preset pseudocode statements, each of the above-mentioned natural language logic parameters, the above-mentioned source code and the generation time corresponding to the above-mentioned source code; and save the above-mentioned code editing record to a database.
[0120] Each module in the pseudocode-based source code generation device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0121] In an exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be shown in FIG4. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, the memory, and the input / output interface are connected via a system bus, and the communication interface, the display unit, and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner may be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a source code generation method based on pseudocode is implemented. The display unit of the computer device is used to form a visually visible picture, which may be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0122] Those skilled in the art will understand that the structure shown in FIG. 4 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0123] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the above-mentioned source code generation method based on pseudocode when executing the computer program.
[0124] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the above-mentioned source code generation method based on pseudocode is implemented.
[0125] In one embodiment, a computer program product is provided, including a computer program, which implements the above-mentioned source code generation method based on pseudocode when executed by a processor.
[0126] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0127] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0128] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0129] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.< / userinfo>
Claims
1. A source code generation method based on pseudocode, characterized in that: The method comprises: When it is detected that the pseudocode editing interface is started, the characters to be matched input in the pseudocode editing interface are obtained; Acquire each candidate preset pseudocode instruction matching the character, and when a selection instruction for each target preset pseudocode instruction in each candidate preset pseudocode instruction is detected, generate each preset pseudocode statement corresponding to each target preset pseudocode instruction in the pseudocode editing interface; Acquire each natural language logic parameter input based on each grammatical information of each preset pseudo code sentence; The preset method models corresponding to the preset pseudo-code statements are obtained, and the source codes corresponding to the preset pseudo-code statements are generated according to the natural language logic parameters and the preset method models.
2. The method according to claim 1, characterized in that The step of obtaining each candidate preset pseudo code instruction matching the character comprises: Matching the character with the instruction name of each preset pseudocode instruction to obtain each candidate preset pseudocode instruction whose instruction name contains the character; Each of the candidate preset pseudocode instructions is displayed in the pseudocode editing interface.
3. The method according to claim 1, characterized in that The target preset pseudo code instruction is one of a method call instruction, a service call instruction, a logic description instruction, a conditional instruction and a code block instruction; The obtaining of each natural language logic parameter input based on each grammatical information of each preset pseudo code statement includes: For each target preset pseudocode instruction, if the target preset pseudocode instruction is a method call instruction or a logic description instruction, a method name and an assignment statement input based on the grammatical information of the preset pseudocode statement are obtained as the natural language logic parameter; and / or, If the target preset pseudocode instruction is a service call instruction, obtaining a service name and an assignment statement input based on the grammatical information of the preset pseudocode statement as the natural language logic parameter; and / or, If the target preset pseudocode instruction is a conditional instruction, obtaining a judgment logic statement input based on the grammatical information of the preset pseudocode statement as the natural language logic parameter; and / or, If the target preset pseudocode instruction is a code block instruction, a code block input based on grammatical information of the preset pseudocode statement is obtained as the natural language logic parameter.
4. The method according to claim 1, characterized in that: Generating source code corresponding to each of the preset pseudo code statements according to each of the natural language logic parameters and each of the preset method models includes: Determine the graphics primitives corresponding to the preset pseudo-code statements according to the execution order corresponding to the preset pseudo-code statements; Generate a corresponding process view according to each of the graphic elements; Determine, according to the graphic element type corresponding to each graphic element, the mapping relationship between each natural language logic parameter corresponding to each graphic element and each preset method model; For each graphic element in the process view, according to the mapping relationship, the natural language logic parameter corresponding to the graphic element is input into the corresponding preset method model to obtain the input preset method model; The source code is generated according to the preset method model after each input corresponding to each of the graphic elements.
5. The method according to claim 4, characterized in that The target preset pseudo code instruction is one of a method call instruction, a service call instruction, a logic description instruction, a conditional instruction and a code block instruction; Determining the graphics primitives corresponding to the preset pseudo-code statements according to the execution order corresponding to the preset pseudo-code statements includes: For each preset pseudocode statement, if the target preset pseudocode instruction corresponding to the preset pseudocode statement is the method call instruction, the service call instruction, the logic description instruction or the code block instruction, then determining that the primitive corresponding to the preset pseudocode statement is a task primitive; If the target preset pseudocode instruction corresponding to the preset pseudocode statement is the conditional instruction, it is determined that the primitive corresponding to the preset pseudocode statement is a control primitive.
6. The method according to claim 5, characterized in that Determining the mapping relationship between each natural language logic parameter corresponding to each graphic element and each preset method model according to the graphic element type corresponding to each graphic element includes: For each of the primitives, if the primitive type corresponding to the primitive is a task primitive, determining that a mapping relationship between a natural language logic parameter corresponding to the primitive and the preset method model is a first mapping relationship; If the primitive type corresponding to the primitive is a control primitive, it is determined that the mapping relationship between the natural language logic parameter corresponding to the primitive and the preset method model is a second mapping relationship.
7. The method according to any one of claims 1 to 6, characterized in that: After generating source code corresponding to each of the preset pseudo code statements according to each of the natural language logic parameters and each of the preset method models, the method further includes: Generate a code editing record according to each of the preset pseudo code statements, each of the natural language logic parameters, the source code and the generation time corresponding to the source code; The code editing record is saved in a database.
8. A source code generation device based on pseudocode, characterized in that: The device comprises: A first acquisition module is used to acquire the characters to be matched input in the pseudocode editing interface when detecting that the pseudocode editing interface is started; A selection module is used to obtain each candidate preset pseudocode instruction matching the character, and when a selection instruction for each target preset pseudocode instruction in each candidate preset pseudocode instruction is detected, generate each preset pseudocode statement corresponding to each target preset pseudocode instruction in the pseudocode editing interface; A second acquisition module is used to acquire each natural language logic parameter input based on each grammatical information of each preset pseudo code sentence; A generation module is used to obtain each preset method model corresponding to each of the preset pseudocode statements, and generate source code corresponding to each of the preset pseudocode statements according to each of the natural language logic parameters and each of the preset method models.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Code generation method and device based on large model, storage medium and equipment
CN120540645A
