[go: up one dir, main page]

CN112835564A - Code generation method and device - Google Patents

Code generation method and device Download PDF

Info

Publication number
CN112835564A
CN112835564A CN202110111200.4A CN202110111200A CN112835564A CN 112835564 A CN112835564 A CN 112835564A CN 202110111200 A CN202110111200 A CN 202110111200A CN 112835564 A CN112835564 A CN 112835564A
Authority
CN
China
Prior art keywords
processed
code generation
code
service
abstraction
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110111200.4A
Other languages
Chinese (zh)
Inventor
姜科
杨洸
林强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Hyperstrong Technology Co Ltd
Original Assignee
Beijing Hyperstrong Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Hyperstrong Technology Co Ltd filed Critical Beijing Hyperstrong Technology Co Ltd
Priority to CN202110111200.4A priority Critical patent/CN112835564A/en
Publication of CN112835564A publication Critical patent/CN112835564A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the application provides a code generation method and a code generation device, wherein when a code is generated, a code generation instruction is received firstly; the code generation instruction comprises an identifier of a service to be processed; abstracting the service to be processed indicated by the identifier of the service to be processed to obtain a description file corresponding to the service to be processed; the description file comprises a plurality of abstraction parameters and parameter values corresponding to the abstraction parameters; generating a target code corresponding to the service to be processed according to the plurality of abstract parameters and the parameter values corresponding to the abstract parameters; and outputting the target code corresponding to the service to be processed. Therefore, when the codes are generated, technicians do not need to manually write the codes, and the automatic generation of the codes is realized, so that the code generation efficiency is effectively improved.

Description

代码生成方法和装置Code generation method and apparatus

技术领域technical field

本申请涉及软件工程技术领域,尤其涉及一种代码生成方法和装置。The present application relates to the technical field of software engineering, and in particular, to a code generation method and apparatus.

背景技术Background technique

软件的开发和运行离不开代码的编写。在软件的开发过程中,通常需要技术人员人为的编写不同的代码,以实现软件的各种功能。The development and operation of software is inseparable from the writing of code. In the process of software development, technicians are usually required to manually write different codes to realize various functions of the software.

但是,在技术人员对代码进行人工编写时,需要耗费大量的时间,使得代码生成的效率较低。However, when a technician manually writes the code, it takes a lot of time, so that the efficiency of code generation is low.

发明内容SUMMARY OF THE INVENTION

本申请实施例提供了一种代码生成方法和装置,在生成代码时,无需技术人员人工进行手动编写,实现了自动化生成代码,从而有效地提高了代码生成的效率。The embodiments of the present application provide a code generation method and device. When generating codes, manual writing by technicians is not required, and automatic code generation is realized, thereby effectively improving the efficiency of code generation.

第一方面,本申请实施例提供了一种代码生成方法,所述代码生成方法包括:In a first aspect, an embodiment of the present application provides a code generation method, and the code generation method includes:

接收代码生成指令;其中,所述代码生成指令中包括待处理业务的标识。A code generation instruction is received; wherein, the code generation instruction includes the identifier of the service to be processed.

对所述待处理业务的标识指示的待处理业务进行抽象化处理,得到所述待处理业务对应的描述文件;其中,所述描述文件中包括多个抽象化参数以及各抽象化参数对应的参数值。Perform abstraction processing on the to-be-processed service indicated by the identifier of the to-be-processed service to obtain a description file corresponding to the to-be-processed service; wherein the description file includes multiple abstraction parameters and parameters corresponding to each abstraction parameter value.

根据所述多个抽象化参数以及所述各抽象化参数对应的参数值,生成所述待处理业务对应的目标代码。The target code corresponding to the service to be processed is generated according to the plurality of abstraction parameters and the parameter values corresponding to the abstraction parameters.

输出所述待处理业务对应的目标代码。The target code corresponding to the service to be processed is output.

在一种可能的实现方式中,所述根据所述多个抽象化参数以及所述各抽象化参数对应的参数值,生成所述待处理业务对应的代码,包括:In a possible implementation manner, generating the code corresponding to the service to be processed according to the multiple abstraction parameters and the parameter values corresponding to the abstraction parameters includes:

根据所述多个抽象化参数,生成所述待处理业务对应的代码生成规则。According to the multiple abstraction parameters, a code generation rule corresponding to the to-be-processed service is generated.

根据所述代码生成规则生成所述代码生成规则对应的代码生成工具;Generate a code generation tool corresponding to the code generation rule according to the code generation rule;

根据所述描述文件和所述代码生成工具生成所述待处理业务对应的目标代码。The target code corresponding to the service to be processed is generated according to the description file and the code generation tool.

在一种可能的实现方式中,所述根据所述描述文件和所述代码生成工具生成所述待处理业务对应的目标代码,包括:In a possible implementation manner, generating the target code corresponding to the business to be processed according to the description file and the code generation tool includes:

将所述描述文件导入至所述代码生成工具中,生成所述待处理业务对应的目标代码。Import the description file into the code generation tool to generate target code corresponding to the business to be processed.

在一种可能的实现方式中,所述根据所述代码生成规则生成所述代码生成规则对应的代码生成工具,包括:In a possible implementation manner, generating a code generation tool corresponding to the code generation rule according to the code generation rule includes:

根据所述代码生成规则,确定所述待处理业务对应的目标代码的架构。According to the code generation rule, the structure of the target code corresponding to the service to be processed is determined.

根据所述待处理业务对应的目标代码的架构,生成所述代码生成规则对应的代码生成工具。According to the structure of the target code corresponding to the business to be processed, a code generation tool corresponding to the code generation rule is generated.

在一种可能的实现方式中,所述描述文件为表格,所述根据所述多个抽象化参数,生成所述待处理业务对应的代码生成规则,包括:In a possible implementation manner, the description file is a table, and the code generation rule corresponding to the business to be processed is generated according to the multiple abstraction parameters, including:

将所述多个抽象化参数中,处于所述表格的表头位置的抽象化参数确定为多个目标抽象化参数。Among the plurality of abstraction parameters, the abstraction parameter at the header position of the table is determined as a plurality of target abstraction parameters.

根据所述多个目标抽象化参数,生成所述待处理业务对应的代码生成规则。According to the multiple target abstraction parameters, a code generation rule corresponding to the to-be-processed service is generated.

在一种可能的实现方式中,所述方法还包括:In a possible implementation, the method further includes:

确定所述待处理业务的类型,所述待处理业务对应的目标代码的函数类型、所述目标代码的文件类型以及所述目标代码的实现方式。Determine the type of the service to be processed, the function type of the target code corresponding to the service to be processed, the file type of the target code, and the implementation manner of the target code.

根据所述待处理业务的类型,所述目标代码的函数类型、所述目标代码的文件类型以及所述目标代码的运行规则,对所述代码生成规则进行更新,得到新的代码生成规则。According to the type of the service to be processed, the function type of the target code, the file type of the target code, and the running rule of the target code, the code generation rule is updated to obtain a new code generation rule.

在一种可能的实现方式中,所述对所述待处理业务的标识指示的待处理业务进行抽象化处理,包括:In a possible implementation manner, performing abstract processing on the to-be-processed service indicated by the identifier of the to-be-processed service includes:

对所述待处理业务进行解析,得到所述待处理业务对应的状态信息、条件信息以及执行动作信息。The to-be-processed service is analyzed to obtain state information, condition information and execution action information corresponding to the to-be-processed service.

基于所述状态信息、所述条件信息以及所述执行动作信息,对所述待处理业务进行抽象化处理。Based on the state information, the condition information, and the execution action information, abstract processing is performed on the to-be-processed service.

第二方面,本申请实施例提供了一种代码生成装置,所述代码生成装置包括:In a second aspect, an embodiment of the present application provides a code generation device, where the code generation device includes:

接收单元,用于接收代码生成指令;其中,所述代码生成指令中包括待处理业务的标识。The receiving unit is configured to receive a code generation instruction; wherein, the code generation instruction includes an identifier of the service to be processed.

处理单元,用于对所述待处理业务的标识指示的待处理业务进行抽象化处理,得到所述待处理业务对应的描述文件;其中,所述描述文件中包括多个抽象化参数以及各抽象化参数对应的参数值。A processing unit, configured to perform abstract processing on the to-be-processed service indicated by the identifier of the to-be-processed service, and obtain a description file corresponding to the to-be-processed service; wherein, the description file includes a plurality of abstraction parameters and each abstraction The parameter value corresponding to the parameterization parameter.

生成单元,用于根据所述多个抽象化参数以及所述各抽象化参数对应的参数值,生成所述待处理业务对应的目标代码。A generating unit, configured to generate a target code corresponding to the service to be processed according to the plurality of abstraction parameters and parameter values corresponding to the abstraction parameters.

输出单元,用于输出所述待处理业务对应的目标代码。The output unit is used for outputting the target code corresponding to the service to be processed.

在一种可能的实现方式中,所述生成单元,具体用于根据所述多个抽象化参数,生成所述待处理业务对应的代码生成规则;根据所述代码生成规则生成所述代码生成规则对应的代码生成工具;根据所述描述文件和所述代码生成工具生成所述待处理业务对应的目标代码。In a possible implementation manner, the generating unit is specifically configured to generate a code generation rule corresponding to the to-be-processed business according to the multiple abstraction parameters; generate the code generation rule according to the code generation rule A corresponding code generation tool; according to the description file and the code generation tool, the target code corresponding to the to-be-processed business is generated.

在一种可能的实现方式中,所述生成单元,具体用于将所述描述文件导入至所述代码生成工具中,生成所述待处理业务对应的目标代码。In a possible implementation manner, the generating unit is specifically configured to import the description file into the code generating tool to generate target code corresponding to the business to be processed.

在一种可能的实现方式中,所述生成单元,具体用于根据所述代码生成规则,确定所述待处理业务对应的目标代码的架构;并根据所述待处理业务对应的目标代码的架构,生成所述代码生成规则对应的代码生成工具。In a possible implementation manner, the generation unit is specifically configured to determine, according to the code generation rule, the structure of the target code corresponding to the business to be processed; and according to the structure of the target code corresponding to the business to be processed to generate a code generation tool corresponding to the code generation rule.

在一种可能的实现方式中,所述生成单元,具体用于将所述多个抽象化参数中,处于所述表格的表头位置的抽象化参数确定为多个目标抽象化参数;根据所述多个目标抽象化参数,生成所述待处理业务对应的代码生成规则。In a possible implementation manner, the generating unit is specifically configured to determine, among the plurality of abstraction parameters, the abstraction parameter at the header position of the table as a plurality of target abstraction parameters; The multiple target abstraction parameters are described, and the code generation rule corresponding to the to-be-processed service is generated.

在一种可能的实现方式中,所述生成单元,具体用于确定所述待处理业务的类型,所述待处理业务对应的目标代码的函数类型、所述目标代码的文件类型以及所述目标代码的实现方式;根据所述待处理业务的类型,所述目标代码的函数类型、所述目标代码的文件类型以及所述目标代码的运行规则,对所述代码生成规则进行更新,得到新的代码生成规则。In a possible implementation manner, the generating unit is specifically configured to determine the type of the service to be processed, the function type of the target code corresponding to the service to be processed, the file type of the target code, and the target Implementation of the code; according to the type of the business to be processed, the function type of the target code, the file type of the target code and the running rule of the target code, the code generation rule is updated to obtain a new Code generation rules.

在一种可能的实现方式中,所述处理单元,具体用于对所述待处理业务进行解析,得到所述待处理业务对应的状态信息、条件信息以及执行动作信息;基于所述状态信息、所述条件信息以及所述执行动作信息,对所述待处理业务进行抽象化处理。In a possible implementation manner, the processing unit is specifically configured to parse the to-be-processed service to obtain state information, condition information and execution action information corresponding to the to-be-processed service; based on the state information, The condition information and the execution action information abstract the service to be processed.

第三方面,本申请实施例还提供了一种代码生成装置,该代码生成装置可以包括存储器和处理器;其中,In a third aspect, an embodiment of the present application further provides a code generation apparatus, and the code generation apparatus may include a memory and a processor; wherein,

所述存储器,用于存储计算机程序。The memory is used to store computer programs.

所述处理器,用于读取所述存储器存储的计算机程序,并根据所述存储器中的计算机程序执行上述第一方面任一种可能的实现方式中所述的代码生成方法。The processor is configured to read the computer program stored in the memory, and execute the code generation method described in any possible implementation manner of the first aspect according to the computer program in the memory.

第四方面,本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机执行指令,当处理器执行所述计算机执行指令时,实现上述第一方面任一种可能的实现方式中所述的代码生成方法。In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, where computer-executable instructions are stored in the computer-readable storage medium, and when a processor executes the computer-executable instructions, any of the above-mentioned first aspect is realized. A code generation method as described in a possible implementation.

第五方面,本申请实施例还提供了一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行时,实现上述第一方面任一种可能的实现方式中所述的代码生成方法。In a fifth aspect, an embodiment of the present application further provides a computer program product, including a computer program, which, when executed by a processor, implements the code generation method described in any possible implementation manner of the first aspect above.

由此可见,本申请实施例提供的代码生成方法和装置,在生成代码时,先接收代码生成指令;其中,代码生成指令中包括待处理业务的标识;对待处理业务的标识指示的待处理业务进行抽象化处理,得到待处理业务对应的描述文件;其中,描述文件中包括多个抽象化参数以及各抽象化参数对应的参数值;并根据多个抽象化参数以及各抽象化参数对应的参数值,生成待处理业务对应的目标代码;并输出待处理业务对应的目标代码。可以看出,在生成代码时,无需技术人员人工进行手动编写,实现了自动化生成代码,从而有效地提高了代码生成的效率。It can be seen that, in the code generation method and device provided by the embodiments of the present application, when generating a code, a code generation instruction is first received; wherein, the code generation instruction includes the identifier of the service to be processed; the service to be processed indicated by the identifier of the service to be processed Perform abstraction processing to obtain a description file corresponding to the business to be processed; wherein, the description file includes multiple abstraction parameters and parameter values corresponding to each abstraction parameter; and according to the multiple abstraction parameters and the parameters corresponding to each abstraction parameter value, generate the target code corresponding to the business to be processed; and output the target code corresponding to the business to be processed. It can be seen that, when generating code, there is no need for technicians to manually write the code, and automatic code generation is realized, thereby effectively improving the efficiency of code generation.

附图说明Description of drawings

此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本公开的实施例,并与说明书一起用于解释本公开的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description serve to explain the principles of the disclosure.

图1为本申请实施例提供的一种代码生成方法的流程示意图;1 is a schematic flowchart of a code generation method provided by an embodiment of the present application;

图2为本申请实施例提供的一种生成待处理业务对应的目标代码的流程示意图;2 is a schematic flowchart of generating a target code corresponding to a service to be processed according to an embodiment of the present application;

图3为本申请实施例提供的另一种生成代码方法的流程示意图;3 is a schematic flowchart of another code generation method provided by an embodiment of the present application;

图4为本申请实施例提供的一种代码运行的流程示意图;FIG. 4 is a schematic flowchart of code operation provided by an embodiment of the present application;

图5为本申请实施例提供的一种代码生成装置的结构示意图;5 is a schematic structural diagram of a code generation apparatus provided by an embodiment of the present application;

图6为本申请实施例提供的另一种代码生成装置的结构示意图。FIG. 6 is a schematic structural diagram of another code generation apparatus provided by an embodiment of the present application.

通过上述附图,已示出本公开明确的实施例,后文中将有更详细的描述。这些附图和文字描述并不是为了通过任何方式限制本公开构思的范围,而是通过参考特定实施例为本领域技术人员说明本公开的概念。The above-mentioned drawings have shown clear embodiments of the present disclosure, and will be described in more detail hereinafter. These drawings and written descriptions are not intended to limit the scope of the disclosed concepts in any way, but rather to illustrate the disclosed concepts to those skilled in the art by referring to specific embodiments.

具体实施方式Detailed ways

这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本公开相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本公开的一些方面相一致的装置和方法的例子。Exemplary embodiments will be described in detail herein, examples of which are illustrated in the accompanying drawings. Where the following description refers to the drawings, the same numerals in different drawings refer to the same or similar elements unless otherwise indicated. The implementations described in the illustrative examples below are not intended to represent all implementations consistent with this disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as recited in the appended claims.

在本申请的实施例中,“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况,其中A,B可以是单数或者复数。在本申请的文字描述中,字符“/”一般表示前后关联对象是一种“或”的关系。In the embodiments of the present application, "at least one" refers to one or more, and "a plurality" refers to two or more. "And/or", which describes the association relationship of the associated objects, means that there can be three kinds of relationships, for example, A and/or B, which can mean that A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. In the text description of this application, the character "/" generally indicates that the contextual object is an "or" relationship.

本申请实施例提供的技术方案可以应用于代码生成场景中。软件功能的实现离不开代码,例如,由于生产厂商以及车型的不同,电动汽车对于接触器的控制方法不同,可以通过电池管理系统(Battery Management System,简称BMS)进行控制,也可以通过整车的其它电控器件进行控制。对于通过BMS软件控制的电动汽车,由于整车需要采用的不同技术方案,因此,软件开发人员往往需要编写不同的代码,实现BMS软件的不同的整体调度和控制时序,从而达到适配整车不同需求的目的。The technical solutions provided by the embodiments of the present application can be applied to code generation scenarios. The realization of software functions is inseparable from the code. For example, due to different manufacturers and models, electric vehicles have different control methods for contactors, which can be controlled through the Battery Management System (BMS), or through the whole vehicle. of other electronic control devices. For electric vehicles controlled by BMS software, software developers often need to write different codes to achieve different overall scheduling and control sequences of BMS software due to the different technical solutions that the whole vehicle needs to adopt, so as to achieve different adaptations to the whole vehicle. purpose of demand.

现有技术中,技术人员根据接收到的指令,确定待开发的软件所需要实现的功能,并根据待开发的软件所需要实现的功能人工编写相应的代码,使得软件能够实现各种不同的功能。但是,人工编写代码需要耗费大量的时间,而且在代码编写的过程中,可能出现编写错误的情况,降低了生成代码的效率。In the prior art, the technician determines the functions that the software to be developed needs to realize according to the received instructions, and manually writes corresponding codes according to the functions that the software to be developed needs to realize, so that the software can realize various functions. . However, it takes a lot of time to write code manually, and in the process of code writing, writing errors may occur, which reduces the efficiency of code generation.

为了解决生成代码的效率低的问题,可以考虑自动化生成代码。本申请实施例提供了一种代码生成方法,先接收代码生成指令;其中,代码生成指令中包括待处理业务的标识;对待处理业务的标识指示的待处理业务进行抽象化处理,得到待处理业务对应的描述文件;其中,描述文件中包括多个抽象化参数以及各抽象化参数对应的参数值;并根据多个抽象化参数以及各抽象化参数对应的参数值,生成待处理业务对应的目标代码;输出待处理业务对应的目标代码。In order to solve the problem of inefficient code generation, you can consider automating code generation. The embodiment of the present application provides a code generation method, which firstly receives a code generation instruction; wherein, the code generation instruction includes an identifier of a service to be processed; and the pending service indicated by the identifier of the service to be processed is abstracted to obtain the to-be-processed service The corresponding description file; wherein, the description file includes multiple abstract parameters and parameter values corresponding to each abstract parameter; and according to the multiple abstract parameters and the parameter values corresponding to each abstract parameter, the target corresponding to the business to be processed is generated Code; output the target code corresponding to the business to be processed.

由此可见,本申请实施例中,在生成代码时,先接收代码生成指令;其中,代码生成指令中包括待处理业务的标识;对待处理业务的标识指示的待处理业务进行抽象化处理,得到待处理业务对应的描述文件;其中,描述文件中包括多个抽象化参数以及各抽象化参数对应的参数值;并根据多个抽象化参数以及各抽象化参数对应的参数值,生成待处理业务对应的目标代码。可以看出,在生成代码时,无需技术人员人工进行手动编写,实现了自动化生成代码,从而有效地提高了代码生成的效率。It can be seen that, in the embodiment of the present application, when generating codes, a code generation instruction is received first; wherein, the code generation instruction includes the identifier of the business to be processed; the business to be processed indicated by the identifier of the business to be processed is abstracted, and the result is obtained A description file corresponding to the business to be processed; wherein, the description file includes multiple abstraction parameters and parameter values corresponding to each abstraction parameter; and according to the multiple abstraction parameters and the parameter values corresponding to each abstraction parameter, the business to be processed is generated the corresponding object code. It can be seen that, when generating code, there is no need for technicians to manually write the code, and automatic code generation is realized, thereby effectively improving the efficiency of code generation.

下面,将通过具体的实施例对本申请提供的代码生成方法进行详细地说明。可以理解的是,下面这几个具体的实施例可以相互结合,对于相同或相似的概念或过程可能在某些实施例不再赘述。Hereinafter, the code generation method provided by the present application will be described in detail through specific embodiments. It can be understood that the following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.

图1为本申请实施例提供的一种代码生成方法的流程示意图。该代码生成方法可以由软件和/或硬件装置执行,例如,该硬件装置可以为代码生成装置,该代码生成装置可以为终端或者终端中的处理芯片。示例的,请参见图1所示,该代码生成方法可以包括:FIG. 1 is a schematic flowchart of a code generation method provided by an embodiment of the present application. The code generation method may be executed by software and/or a hardware device, for example, the hardware device may be a code generation device, and the code generation device may be a terminal or a processing chip in the terminal. For an example, see Figure 1, the code generation method may include:

S101、接收代码生成指令。S101. Receive a code generation instruction.

其中,代码生成指令中包括待处理业务的标识。Wherein, the code generation instruction includes the identifier of the service to be processed.

示例的,代码生成指令有多种形式,可以为文字形式,也可以为特征的符号,其主要用于标识待处理业务。本申请实施例对于代码生成指令的形式,以及待处理业务标识的形式不做任何限制。By way of example, the code generation instruction has various forms, which may be in the form of text, or may be a characteristic symbol, which is mainly used to identify the business to be processed. The embodiments of the present application do not impose any restrictions on the form of the code generation instruction and the form of the service identifier to be processed.

S102、对待处理业务的标识指示的待处理业务进行抽象化处理,得到待处理业务对应的描述文件。S102. Perform abstraction processing on the to-be-processed service indicated by the identifier of the to-be-processed service to obtain a description file corresponding to the to-be-processed service.

示例的,在对待处理业务的标识指示的待处理业务进行抽象化处理时,可以先对待处理业务进行解析,得到待处理业务对应的状态信息、条件信息以及执行作用信息;并基于状态信息、条件信息以及执行动作信息,对待处理业务进行抽象化处理。For example, when abstracting the to-be-processed business indicated by the identifier of the to-be-processed business, the to-be-processed business may be parsed first to obtain status information, condition information, and execution function information corresponding to the to-be-processed business; Information and execution action information to abstract the business to be processed.

其中,状态信息可以包括多个不同状态,条件信息可以包括多个不同的条件,执行动作信息可以包括多个不同的执行动作,且待处理业务对应的状态信息可以包括多个子状态。例如,状态信息可以包括3个子状态,分别为初始化子状态、运行子状态以及退出子状态。条件信息可以为各个不同的状态之间的跳转信息,执行动作信息可以为每个子状态需要执行的动作。可以理解的是,状态信息、条件信息以及执行作用信息均可用特殊的字符进行表示,本申请实施例对于具体的表示方式不做任何限制。The state information may include multiple different states, the condition information may include multiple different conditions, the execution action information may include multiple different execution actions, and the state information corresponding to the service to be processed may include multiple sub-states. For example, the state information may include three sub-states, which are an initialization sub-state, a running sub-state, and an exit sub-state. The condition information may be jump information between different states, and the execution action information may be actions to be executed in each sub-state. It can be understood that, the status information, the condition information, and the execution action information can all be represented by special characters, and the embodiments of the present application do not impose any limitation on the specific representation.

在本申请实施例,通过将待处理解析为状态信息、条件信息以及执行动作,并进行抽象化处理,可以实现将待处理业务转化为可以被计算机识别的语言,这样可以有效地提升代码生成的成功率。In this embodiment of the present application, by parsing the pending processing into status information, condition information and execution actions, and performing abstract processing, the pending business can be converted into a language that can be recognized by the computer, which can effectively improve the code generation performance. Success rate.

在对待处理业务的标识指示的待处理业务进行抽象化处理时,可以得到待处理业务对应的描述文件,该描述文件中包括多个抽象化参数以及各抽象化参数对应的参数值。其中,抽象化参数可以为对待处理业务进行解析得到的状态信息、条件信息、执行动作信息,以及其对应的具体信息和数量,抽象化参数对应的参数则可以为状态信息、条件信息、执行动作信息分别对应的具体数值。本申请实施例对于抽象化参数以及各抽象化参数对应的参数值的具体内容不做任何限定。其中,描述文件的形式可以为多种类型,例如,描述文件可以为EXCEL表格,本申请实施例对于描述文件的具体类型不做任何限定。When abstracting the to-be-processed service indicated by the identifier of the to-be-processed service, a description file corresponding to the to-be-processed service can be obtained, and the description file includes multiple abstraction parameters and parameter values corresponding to each abstraction parameter. Among them, the abstraction parameters can be the status information, condition information, execution action information obtained by analyzing the business to be processed, as well as their corresponding specific information and quantity, and the parameters corresponding to the abstraction parameters can be status information, condition information, execution action information The information corresponds to the specific value. The embodiments of the present application do not make any limitation on the specific content of the abstraction parameters and the parameter values corresponding to each abstraction parameter. The form of the description file may be of various types, for example, the description file may be an EXCEL form, and the embodiment of the present application does not make any limitation on the specific type of the description file.

在对待处理业务的标识指示的待处理业务进行抽象化处理,得到待处理业务对应的描述文件后,就可以根据多个抽象化参数以及各抽象化参数对应的参数值,生成待处理业务对应的目标代码,即执行下述S103:After abstracting the to-be-processed service indicated by the identifier of the to-be-processed service, and obtaining the description file corresponding to the to-be-processed service, the corresponding to-be-processed service can be generated according to multiple abstraction parameters and parameter values corresponding to each abstraction parameter. The target code, that is, execute the following S103:

S103、根据多个抽象化参数以及各抽象化参数对应的参数值,生成待处理业务对应的目标代码。S103 , according to the multiple abstraction parameters and the parameter values corresponding to each abstraction parameter, generate a target code corresponding to the service to be processed.

在根据多个抽象化参数以及各参数对应的参数值,生成待处理业务对应的目标代码时,可以直接获取抽象化参数以及各抽象化参数对应的参数值,也可以通过获取描述文件,读取描述中的抽象化参数以及各抽象化参数对应的参数值,具体的,本申请实施例不做任何限制。When generating the target code corresponding to the business to be processed according to multiple abstraction parameters and the parameter values corresponding to each parameter, the abstraction parameters and the parameter values corresponding to each abstraction parameter can be directly obtained, or the description file can be obtained to read The abstraction parameters in the description and the parameter values corresponding to the abstraction parameters are not specifically limited in the embodiments of the present application.

在分别获取到多个抽象化参数以及各抽象化参数对应的参数值后,就可以根据该根据多个抽象化参数以及各抽象化参数对应的参数值,生成待处理业务对应的目标代码,并输出该目标代码。After obtaining the multiple abstract parameters and the parameter values corresponding to the abstract parameters, the target code corresponding to the business to be processed can be generated according to the multiple abstract parameters and the parameter values corresponding to the abstract parameters. Output the object code.

S104、输出待处理业务对应的目标代码。S104, output the target code corresponding to the business to be processed.

示例的,在输出待处理业务对应的目标代码时,若设置目标代码的文件存储类型,则将待处理业务对应的目标代码存储在对应的文件存储类型的文件内,输出含有目标代码的文件;若未设置目标代码的文件存储类型,则将待处理业务对应的目标代码存储在默认文件存储类型的文件内,输出默认文件存储类型的文件,其中,默认文件存储类型为用户上一次设置的文件存储类型,具体可以根据实际需要进行设置。Exemplarily, when outputting the target code corresponding to the business to be processed, if the file storage type of the target code is set, then the target code corresponding to the business to be processed is stored in the file of the corresponding file storage type, and the file containing the target code is output; If the file storage type of the target code is not set, the target code corresponding to the business to be processed is stored in the file of the default file storage type, and the file of the default file storage type is output, wherein the default file storage type is the file set last time by the user Storage type, which can be set according to actual needs.

由此可见,本申请实施例提供的代码生成方法,在生成代码时,先接收代码生成指令;其中,代码生成指令中包括待处理业务的标识;对待处理业务的标识指示的待处理业务进行抽象化处理,得到待处理业务对应的描述文件;其中,描述文件中包括多个抽象化参数以及各抽象化参数对应的参数值;并根据多个抽象化参数以及各抽象化参数对应的参数值,生成待处理业务对应的目标代码。可以看出,在生成代码时,无需技术人员人工进行手动编写,实现了自动化生成代码,从而有效地提高了代码生成的效率。It can be seen that, in the code generation method provided by the embodiment of the present application, when generating code, a code generation instruction is first received; wherein, the code generation instruction includes the identifier of the service to be processed; the service to be processed indicated by the identifier of the service to be processed is abstracted process to obtain a description file corresponding to the business to be processed; wherein, the description file includes multiple abstraction parameters and parameter values corresponding to each abstraction parameter; and according to the multiple abstraction parameters and the parameter values corresponding to each abstraction parameter, Generate the target code corresponding to the business to be processed. It can be seen that, when generating code, there is no need for technicians to manually write the code, and automatic code generation is realized, thereby effectively improving the efficiency of code generation.

基于上述图1所示的实施例,为了便于理解在本申请实施例中,如何根据多个抽象化参数以及各抽象化参数对应的参数值,生成待处理业务对应的目标代码,下面,将通过图2所示的实施例,详细描述在本申请实施例中,如何根据多个抽象化参数以及各抽象化参数对应的参数值,生成待处理业务对应的目标代码。Based on the above-mentioned embodiment shown in FIG. 1 , in order to facilitate understanding in the embodiment of the present application, how to generate the target code corresponding to the service to be processed according to the multiple abstraction parameters and the parameter values corresponding to each abstraction parameter. The embodiment shown in FIG. 2 describes in detail how the target code corresponding to the service to be processed is generated according to the multiple abstraction parameters and the parameter values corresponding to each abstraction parameter in the embodiment of the present application.

图2为本申请实施例提供的一种生成待处理业务对应的目标代码的流程示意图。该生成待处理业务对应的目标代码的方法同样可以由软件和/或硬件装置执行。示例的,请参见图2所示,该生成待处理业务对应的目标代码的方法可以包括:FIG. 2 is a schematic flowchart of generating a target code corresponding to a service to be processed according to an embodiment of the present application. The method for generating the target code corresponding to the service to be processed can also be executed by software and/or hardware devices. By way of example, as shown in FIG. 2 , the method for generating target codes corresponding to services to be processed may include:

S201、根据多个抽象化参数,生成待处理业务对应的代码生成规则。S201. Generate a code generation rule corresponding to the to-be-processed business according to multiple abstraction parameters.

示例的,在根据多个抽象化参数,生成待处理业务对应的代码生成规则时,可以先对多个抽象化参数进行处理,确定代码生成规则所需要的抽象化参数,即目标抽象化参数。示例的,若描述文件为表格,则将多个抽象化参数中,处于表格的表头位置的抽象化参数确定为对个目标抽象化参数;并根据多个目标抽象化参数,生成待处理业务对应的代码生成规则。示例的,若描述文件为文本,则可以通过读取文本的初始位置即可获取多个目标抽象化参数,具体可以根据实际需要进行设置。For example, when generating a code generation rule corresponding to a business to be processed according to multiple abstraction parameters, the multiple abstraction parameters may be processed first to determine the abstraction parameter required by the code generation rule, that is, the target abstraction parameter. For example, if the description file is a table, the abstraction parameter at the header position of the table among the plurality of abstraction parameters is determined as the target abstraction parameter; and according to the plurality of target abstraction parameters, the business to be processed is generated. Corresponding code generation rules. For example, if the description file is text, multiple target abstraction parameters can be obtained by reading the initial position of the text, which can be set according to actual needs.

根据上述实施例所述,当抽象化参数为待处理业务对应的代码中所包含的状态信息、条件信息以及执行动作信息的具体信息和数量时,对应的,代码生成规则为状态信息、条件信息以及执行动作信息的数量信息。例如,若抽象化参数为2个状态信息、4个条件信息以及5个执行动作信息,则对应的代码生成规则为生成的代码中需要包括2个状态、4个跳转条件以及5个执行动作。According to the above-mentioned embodiment, when the abstraction parameter is the specific information and quantity of the state information, condition information and execution action information contained in the code corresponding to the business to be processed, correspondingly, the code generation rule is the state information, condition information And the number information of the execution action information. For example, if the abstraction parameters are 2 state information, 4 condition information and 5 execution action information, the corresponding code generation rule is that the generated code needs to include 2 states, 4 jump conditions and 5 execution actions .

在本申请实施例中,通过确定多个目标抽象化参数,并生成对应的代码生成规则,能够避免除目标抽象化参数外的其它抽象化参数对目标代码造成影响,该生成规则可以用于辅助生成对应的目标代码。In this embodiment of the present application, by determining multiple target abstraction parameters and generating corresponding code generation rules, it is possible to avoid other abstraction parameters except the target abstraction parameters from affecting the target code, and the generation rules can be used to assist Generate the corresponding object code.

此外,为了进一步完善该生成规则,还可以通过确定待处理业务的类型,待处理业务对应的目标代码的函数类型、目标代码的文件类型以及目标代码的实现方式;并根据待处理业务的类型,目标代码的函数类型、目标代码的文件类型以及目标代码的运行规则,对代码生成规则进行更新,得到新的代码生成规则,这样可以进一步提高生成规则的完整性,从而更好地辅助生成对应的目标代码。In addition, in order to further improve the generation rule, it is also possible to determine the type of the business to be processed, the function type of the target code corresponding to the business to be processed, the file type of the target code and the implementation method of the target code; and according to the type of the business to be processed, The function type of the target code, the file type of the target code, and the running rules of the target code, update the code generation rules to obtain new code generation rules, which can further improve the integrity of the generation rules and better assist in the generation of corresponding object code.

其中,待处理业务的类型、待处理业务对应的目标代码的函数类型、目标代码的文件类型以及目标代码的实现方式可以根据具体的业务进行确定。例如,待处理业务对应的目标代码的函数类型可以为void xxx_step(void)的形式,目标代码的文件类型可以为xxx.c和xxx.h的形式,目标代码的实现方式可以为switch……case……的形式,本申请实施例对此不做任何限定。The type of the service to be processed, the function type of the target code corresponding to the service to be processed, the file type of the target code, and the implementation mode of the target code can be determined according to the specific service. For example, the function type of the target code corresponding to the business to be processed can be in the form of void xxx_step(void), the file type of the target code can be in the form of xxx.c and xxx.h, and the implementation method of the target code can be switch...case ... form, the embodiments of the present application do not make any limitation on this.

可以看出,在本申请实施例中,通过生成新的代码生成规则,其目的在于:可以使得生成目标代码的风格统一,避免了多个技术人员对于代码进行分工编写而造成的代码风格不统一以及出现逻辑错误的问题,提高了代码生成的效率。It can be seen that, in the embodiment of the present application, by generating new code generation rules, the purpose is to make the style of the generated target code uniform, and avoid the inconsistent code style caused by the division of labor by multiple technicians to write the code. As well as the problem of logical errors, the efficiency of code generation is improved.

S202、根据代码生成规则生成代码生成规则对应的代码生成工具。S202. Generate a code generation tool corresponding to the code generation rule according to the code generation rule.

示例的,在根据代码生成规则生成代码生成规则对应的代码生成工具时,可以根据代码生成规则,确定待处理业务对应的目标代码的架构;根据待处理业务对应的目标代码的架构,生成代码生成规则对应的代码生成工具。其中,待处理业务对应的目标代码的架构可以包括生成的目标代码的重复部分,也可以包括其他部分,本申请实施例对此不做任何限定。For example, when the code generation tool corresponding to the code generation rule is generated according to the code generation rule, the structure of the target code corresponding to the business to be processed can be determined according to the code generation rule; according to the structure of the target code corresponding to the business to be processed, the code generation The code generation tool corresponding to the rule. Wherein, the structure of the target code corresponding to the service to be processed may include a duplicate part of the generated target code, or may include other parts, which are not limited in this embodiment of the present application.

进一步地,在根据待处理业务对应的目标代码的架构,生成代码生成规则对应的代码生成工具时,可以根据目标代码的架构编写对应的代码生成工具,也可以通过其他方式生成对应的代码生成工具,本申请实施例对此不做任何限定。Further, when generating the code generation tool corresponding to the code generation rule according to the structure of the target code corresponding to the business to be processed, the corresponding code generation tool may be written according to the structure of the target code, or the corresponding code generation tool may be generated in other ways. , the embodiments of the present application do not make any limitation on this.

在本申请实施例中,通过代码生成规则确定待处理业务对应的目标代码的架构,并生成对应的代码生成工具,使得能够通过代码生成工具生成对应的目标代码,提高了生成代码的准确度和效率。In the embodiment of the present application, the structure of the target code corresponding to the business to be processed is determined by the code generation rule, and the corresponding code generation tool is generated, so that the corresponding target code can be generated by the code generation tool, and the accuracy and the accuracy of the generated code are improved. efficiency.

S203、根据描述文件和代码生成工具生成待处理业务对应的目标代码。S203. Generate a target code corresponding to the business to be processed according to the description file and the code generation tool.

示例的,在根据描述文件和代码生成工具生成待处理业务对应的目标代码时,可以将描述文件导入至代码生成工具中,生成待处理业务对应的目标代码。For example, when the target code corresponding to the service to be processed is generated according to the description file and the code generation tool, the description file may be imported into the code generation tool to generate the target code corresponding to the service to be processed.

其中,代码生成工具可以先根据描述文件中的多个抽象画参数对应的参数值,确定目标代码需要的多个目标抽象化参数值,并将多个目标抽象化参数值与待处理业务对应的目标代码的架构进行拼凑,或者将多个目标抽象化参数值补充至目标代码的架构中,从而生成待处理业务对应的目标代码。具体的生成方式可根据实际情况进行设置。通过将描述文件导入至代码生成工具中,使得代码工具根据描述文件中的抽象化参数对应的参数值,生成待处理业务对应的目标代码,避免了人工编写代码出现错误的问题,提高了代码生成的效率。Among them, the code generation tool can first determine the multiple target abstraction parameter values required by the target code according to the parameter values corresponding to the multiple abstract painting parameters in the description file, and associate the multiple target abstraction parameter values with those corresponding to the business to be processed. The structure of the target code is pieced together, or multiple target abstraction parameter values are supplemented into the structure of the target code, thereby generating the target code corresponding to the business to be processed. The specific generation method can be set according to the actual situation. By importing the description file into the code generation tool, the code tool can generate the target code corresponding to the business to be processed according to the parameter values corresponding to the abstract parameters in the description file, which avoids the problem of errors in manual code writing and improves code generation. s efficiency.

综上所述,本申请实施例提供的代码生成方法,在根据多个抽象化参数以及各抽象化参数对应的参数值,生成待处理业务对应的目标代码时,先根据多个抽象化参数,生成待处理业务对应的代码生成规则;并根据代码生成规则生成对应的代码生成工具;根据描述文件和代码生成工具生成待处理业务对应的目标代码,这样能够避免人工手动编写代码造成的耗时长以及错误率高的问题,提高了代码生成的效率。To sum up, in the code generation method provided by the embodiments of the present application, when generating the target code corresponding to the business to be processed according to the multiple abstraction parameters and the parameter values corresponding to each abstraction parameter, firstly according to the multiple abstraction parameters, Generate code generation rules corresponding to the business to be processed; generate corresponding code generation tools according to the code generation rules; The problem of high error rate improves the efficiency of code generation.

为了便于理解本申请实施例提供的代码生成方法,下面,将以该方法在实际中的具体应用为例,对本申请实施例提供的技术方案进行详细的描述。可参见图3所示,图3为本申请实施例提供的另一种生成代码方法的流程示意图。In order to facilitate understanding of the code generation method provided by the embodiments of the present application, the following will take the specific application of the method in practice as an example to describe the technical solutions provided by the embodiments of the present application in detail. Referring to FIG. 3 , FIG. 3 is a schematic flowchart of another code generation method provided by an embodiment of the present application.

在代码的生成中可以采用调度器进行,能够保证代码的生成过程各个软件和\或硬件装置的分工明确,从而提升代码生成的效率。图3中的调度定义,即为在接收到代码生成指令时,可以确定待处理业务的类型以及待处理业务的标识,通过对待处理业务进行解析,确定待处理业务对应的状态信息、条件信息以及执行动作信息。假设待处理业务对应的状态通过S表示,条件通过C表示,执行动作通过A表示。The scheduler can be used in the generation of the code, which can ensure that the division of labor of each software and/or hardware device in the code generation process is clear, thereby improving the efficiency of code generation. The scheduling definition in Figure 3 is that when the code generation instruction is received, the type of the service to be processed and the identifier of the service to be processed can be determined, and the state information, condition information and Execute action information. It is assumed that the state corresponding to the business to be processed is represented by S, the condition is represented by C, and the execution action is represented by A.

示例的,状态S可以包括初始化状态S0和多个运行状态S1~Sn,条件C可以为每个状态S之间的状态跳转条件,Cx_y表示状态Sx向状态Sy的跳转条件,例如,C1_2表示状态S1向状态S2的跳转条件。其中,每一个状态S均包括3个子状态,分别为初始化子状态en、运行子状态du以及退出子状态ex。执行动作A为每个子状态执行的动作,其中,执行初始化子状态en的动作可以为Aen_1~Aen_n,表示依次执行初始化子状态1至子状态n的动作;执行运行子状态du的动作可以为Adu_1~Adu_n,表示依次执行运行子状态1至子状态n的动作;执行退出子状态ex的动作可以为Aex_1~Aex_n,表示依次执行退出子状态1至子状态n的动作。Illustratively, the state S may include an initialization state S0 and a plurality of operating states S1 to Sn, the condition C may be a state transition condition between each state S, and Cx_y represents a transition condition from the state Sx to the state Sy, for example, C1_2 Indicates the transition condition from state S1 to state S2. Among them, each state S includes three sub-states, which are an initialization sub-state en, a running sub-state du and an exit sub-state ex. The execution action A is the action executed by each sub-state, wherein the action of executing the initialization sub-state en can be Aen_1 to Aen_n, which means that the actions of initializing sub-state 1 to sub-state n are executed in sequence; the action of executing the running sub-state du can be Adu_1 ~Adu_n means that the actions of running sub-state 1 to sub-state n are executed in sequence; the actions of executing and exiting sub-state ex can be Aex_1-Aex_n, which means that the actions of exiting sub-state 1 to sub-state n are sequentially executed.

可以理解的是,上述状态跳转条件为实际代码中对应的条件,执行动作为基础软件层所提供的函数接口。其中,状态、条件和执行动作之间的关系可以参见图4所示,图4为本申请实施例提供的一种代码运行的流程示意图。It can be understood that the above state jump conditions are corresponding conditions in the actual code, and the execution actions are function interfaces provided by the basic software layer. The relationship between states, conditions, and execution actions can be referred to as shown in FIG. 4 , which is a schematic flowchart of code running provided by an embodiment of the present application.

根据图4所示,在代码运行过程中,先依次执行初始化状态S0中的初始化子状态en的动作,即依次执行初始化子状态1至初始化子状态n的动作。在完成子状态的初始化后,依次执行初始化状态S0中的运行子状态du的动作,即依次执行运行子状态1至运行子状态n的动作,且该依次运行n个子状态的动作是循环进行的,直至接收到跳转条件C=C0_x。在接收到跳转条件后,停止依次执行初始化状态S0中的运行子状态的动作,变为依次执行初始化状态S0中的退出子状态ex的动作,即依次执行退出子状态1至退出子状态n的动作。其中,跳转条件可以为从初始化状态S0跳转至状态S1,也可以为从初始化状态S0跳转至状态S1,本申请实施例对于具体的跳转条件不做任何限定。As shown in FIG. 4 , during the running of the code, the actions of the initialization sub-state en in the initialization state S0 are sequentially performed, that is, the actions of the initialization sub-state 1 to the initialization sub-state n are sequentially performed. After the initialization of the sub-states is completed, the actions of the running sub-state du in the initialization state S0 are executed in sequence, that is, the actions of the running sub-state 1 to the running sub-state n are executed in sequence, and the action of running the n sub-states in sequence is performed cyclically , until the jump condition C=C0_x is received. After receiving the jump condition, stop executing the actions of the running sub-states in the initialization state S0 in sequence, and change to execute the actions of exiting the sub-state ex in the initialization state S0 in sequence, that is, executing the exit sub-state 1 to the exit sub-state n in sequence Actions. The jumping condition may be jumping from the initialization state S0 to the state S1, or jumping from the initialization state S0 to the state S1, and the embodiment of the present application does not make any limitation on the specific jumping condition.

在执行完初始化状态S0中的多个子状态的退出动作后,根据具体的跳转条件进行状态的跳转。若跳转条件为C=C0_1,则由初始化状态S0跳转至状态S1,按照状态S1中的代码运行方式进行运行,并根据接收到的跳转条件C=C1_2,由状态S1跳转至状态S2,按照状态S2中的代码运行方式进行运行。若跳转条件为C=C0_2,则由初始化状态S0跳转至状态S2,按照状态S2中的代码运行方式进行运行,并根据接收到的跳转条件C=C2_1,由状态S2跳转至状态S1,按照状态S1中的代码运行方式进行运行。根据图3所示,状态S1和状态S2中的代码运行方式均与上述初始化状态S0内的代码运行方式是相同的,本申请实施例对此不再赘述。After executing the exit actions of the multiple sub-states in the initialization state S0, the state jumps are performed according to specific jump conditions. If the jump condition is C=C0_1, jump from the initialization state S0 to the state S1, run according to the code running mode in the state S1, and jump from the state S1 to the state according to the received jump condition C=C1_2 S2, run according to the code running mode in state S2. If the jump condition is C=C0_2, jump from the initialization state S0 to the state S2, run according to the code running mode in the state S2, and jump from the state S2 to the state according to the received jump condition C=C2_1 S1, run according to the code running mode in state S1. As shown in FIG. 3 , the code running modes in the state S1 and the state S2 are the same as the code running modes in the above-mentioned initialization state S0 , which are not repeated in this embodiment of the present application.

其中,图4所示的跳转条件可以时同时跳转,也可以是按照一定的时间顺序进行跳转,本申请实施例对此不做任何限定。The jump conditions shown in FIG. 4 may be jumped at the same time, or may be jumped according to a certain time sequence, which is not limited in this embodiment of the present application.

根据图3所示,在进行调度定义后,可以建立调度描述文件,即根据上述对待处理业务的解析结果,得到待处理业务对应的描述文件。其中,调度描述文件可参见下述表1所示。表1为调度器状态表,其包括生成代码的状态的数量、初始化状态动作及其对应的数量、执行状态动作及其对应的数量。As shown in FIG. 3 , after the scheduling definition is performed, a scheduling description file can be established, that is, a description file corresponding to the service to be processed is obtained according to the above analysis result of the service to be processed. The scheduling description file can be referred to as shown in Table 1 below. Table 1 is a scheduler state table, which includes the number of states in which code is generated, initialization state actions and their corresponding numbers, and execution state actions and their corresponding numbers.

表1Table 1

Figure BDA0002919416130000121
Figure BDA0002919416130000121

表1中包括多个抽象化参数以及各抽象化参数对应的参数值,其中,表1中的表头部分为多个抽象化参数,即状态标识、状态编号、初始化动作标识、初始化动作1、初始化动作2、执行动作标识、执行动作1以及执行动作2。抽象化参数对应的各个参数值均为每个抽象化参数所在列的数值,例如,状态编号对应的参数值为0、1和2。Table 1 includes a plurality of abstraction parameters and parameter values corresponding to each abstraction parameter, wherein the table header in Table 1 is divided into a plurality of abstraction parameters, namely state identifier, state number, initialization action identifier, initialization action 1, Initialize action 2, execute action flag, execute action 1, and execute action 2. Each parameter value corresponding to the abstraction parameter is the value of the column where each abstraction parameter is located. For example, the parameter values corresponding to the state number are 0, 1, and 2.

此外,调度描述文件还包括调度器状态迁移表,可参见下述表2所示。In addition, the scheduling description file also includes a scheduler state transition table, as shown in Table 2 below.

表2Table 2

Figure BDA0002919416130000131
Figure BDA0002919416130000131

表2中同样包括多个抽象化参数以及各抽象化参数对应的参数值,其中,抽象化参数为表2的表头部分,即抽象化参数为状态跳转标识、当前状态、目标状态、跳转条件、退出状态动作标识、退出状态动作1以及退出状态动作2。参数值为各抽象化所在列的数值,例如,抽象化参数跳转条件对应的参数值为C==C0_1、C==C0_2、C==C1_2、C==C1_0、C==C2_0以及C==C2_1。Table 2 also includes multiple abstraction parameters and parameter values corresponding to each abstraction parameter, wherein the abstraction parameter is the header part of Table 2, that is, the abstraction parameter is the state jump identifier, current state, target state, jump state Transition condition, exit state action flag, exit state action 1, and exit state action 2. The parameter value is the value of the column where each abstraction is located. For example, the parameter value corresponding to the jump condition of the abstraction parameter is C==C0_1, C==C0_2, C==C1_2, C==C1_0, C==C2_0 and C ==C2_1.

根据表1和表2确定目标抽象化参数,其中,目标抽象化参数为状态编号、初始化动作1、初始化动作2、执行动作1、执行动作2、当前状态、目标状态、跳转条件、退出状态动作1以及退出状态动作2,根据目标抽象化参数生成对应的代码生成规则。Determine the target abstraction parameters according to Table 1 and Table 2, wherein the target abstraction parameters are state number, initialization action 1, initialization action 2, execution action 1, execution action 2, current state, target state, jump condition, exit state Action 1 and exit status action 2 generate corresponding code generation rules according to the target abstraction parameters.

示例的,为例进一步完善生成的代码生成规则,除表1和表2中所示的抽象化参数以及各抽象化参数对应的参数值之外,还需要对调度器的参数进行设置,可通过下述表3的中的参数对调度器的参数进行设置,表3为调度器设计表。As an example, to further improve the generated code generation rules, in addition to the abstraction parameters shown in Table 1 and Table 2 and the parameter values corresponding to each abstraction parameter, it is also necessary to set the parameters of the scheduler, which can be done by The parameters in the following Table 3 set the parameters of the scheduler, and Table 3 is the scheduler design table.

表3table 3

调度器名称scheduler name 状态数量number of states 状态变量名称state variable name APPScAPPSc 33 APPScStepAPPScStep

根据表3中的参数可知,本申请实施例的代码生成方法可以采用状态机来实现,且状态机的数量与表3中的状态数量一致,状态机在运行过程中的状态跳转、状态跳转条件以及各个状态的执行动作与表1和表2中的抽象化参数对应的参数值一致。其中,根据表3中的状态变量名称可知,本申请实施例中状态机为switch……case……的形式。According to the parameters in Table 3, it can be seen that the code generation method of the embodiment of the present application can be implemented by using a state machine, and the number of state machines is consistent with the number of states in Table 3. The transition conditions and the execution actions of each state are consistent with the parameter values corresponding to the abstracted parameters in Table 1 and Table 2. Among them, according to the state variable names in Table 3, it can be known that the state machine in the embodiment of the present application is in the form of switch...case....

可以理解的是,可以根据表3所示的调度器的参数对生成的代码生成规则进行更新完善,得到新的代码生成规则。示例的,在对代码生成规则进行更新时,还可以设置生成代码的其他参数,例如,生成的目标代码包含一个.c和一个.h的文件,生成的文件名分别为xxx.c和xxx.h,其中,xxx为调度名称;且xxx.h中需添加type.h和util.h头文件引用,使得嵌入式芯片相对应的数据类型和系统定义一致;目标代码可以为一个独立的函数,函数名可以为void xxx_step(void)的形式,同时需要在xxx.h中对该函数进行标记。本申请实施例仅以上述参数为例对生成的代码生成规则进行更新,但并不代表本申请实施例仅局限于此。It can be understood that the generated code generation rules can be updated and improved according to the parameters of the scheduler shown in Table 3 to obtain new code generation rules. For example, when updating the code generation rule, other parameters of the generated code can also be set. For example, the generated object code contains a .c and a .h file, and the generated file names are xxx.c and xxx. h, where xxx is the scheduling name; and the type.h and util.h header file references need to be added to xxx.h, so that the corresponding data type of the embedded chip is consistent with the system definition; the target code can be an independent function, The function name can be in the form of void xxx_step(void), and the function needs to be marked in xxx.h. This embodiment of the present application only uses the above parameters as an example to update the generated code generation rule, which does not mean that the embodiment of the present application is limited to this.

根据图3所示,在生成新的代码生成规则后,根据新的代码生成规则,编写相对应的代码生成工具,并通过将表1和表2所示的调度描述文件导入代码生成工具内,代码生成工具通过读取目标抽象化参数对应的参数值,可以自动生成代码,即生成待处理业务对应的目标代码。As shown in Figure 3, after generating the new code generation rule, write the corresponding code generation tool according to the new code generation rule, and import the scheduling description files shown in Table 1 and Table 2 into the code generation tool, The code generation tool can automatically generate code by reading the parameter value corresponding to the target abstraction parameter, that is, generate the target code corresponding to the business to be processed.

根据上述方法生成的目标代码为:The object code generated according to the above method is:

Figure BDA0002919416130000141
Figure BDA0002919416130000141

Figure BDA0002919416130000151
Figure BDA0002919416130000151

Figure BDA0002919416130000161
Figure BDA0002919416130000161

Figure BDA0002919416130000171
Figure BDA0002919416130000171

Figure BDA0002919416130000181
Figure BDA0002919416130000181

Figure BDA0002919416130000191
Figure BDA0002919416130000191

图5为本申请实施例提供的一种代码生成装置50的结构示意图,示例的,请参见图5所示,该代码生成装置50可以包括:FIG. 5 is a schematic structural diagram of a code generation apparatus 50 provided by an embodiment of the present application. For example, referring to FIG. 5 , the code generation apparatus 50 may include:

接收单元501,用于接收代码生成指令;其中,代码生成指令中包括待处理业务的标识。The receiving unit 501 is configured to receive a code generation instruction, wherein the code generation instruction includes an identifier of a service to be processed.

处理单元502,用于对待处理业务的标识指示的待处理业务进行抽象化处理,得到待处理业务对应的描述文件;其中,描述文件中包括多个抽象化参数以及各抽象化参数对应的参数值。The processing unit 502 is used for abstracting the to-be-processed business indicated by the identifier of the to-be-processed business to obtain a description file corresponding to the to-be-processed business; wherein the description file includes multiple abstraction parameters and parameter values corresponding to each abstraction parameter .

生成单元503,用于根据多个抽象化参数以及各抽象化参数对应的参数值,生成待处理业务对应的目标代码。The generating unit 503 is configured to generate the target code corresponding to the service to be processed according to the multiple abstraction parameters and the parameter values corresponding to each abstraction parameter.

输出单元504,用于输出待处理业务对应的目标代码。The output unit 504 is used for outputting the target code corresponding to the service to be processed.

可选的,生成单元503,具体用于根据多个抽象化参数,生成待处理业务对应的代码生成规则;根据代码生成规则生成代码生成规则对应的代码生成工具;根据描述文件和代码生成工具生成待处理业务对应的目标代码。Optionally, the generating unit 503 is specifically configured to generate a code generation rule corresponding to the business to be processed according to a plurality of abstract parameters; generate a code generation tool corresponding to the code generation rule according to the code generation rule; generate a code generation tool according to the description file and the code generation tool. The target code corresponding to the business to be processed.

可选的,生成单元503,具体用于将描述文件导入至代码生成工具中,生成待处理业务对应的目标代码。Optionally, the generating unit 503 is specifically configured to import the description file into the code generation tool, and generate the target code corresponding to the service to be processed.

可选的,生成单元503,具体用于根据代码生成规则,确定待处理业务对应的目标代码的架构;并根据待处理业务对应的目标代码的架构,生成代码生成规则对应的代码生成工具。Optionally, the generating unit 503 is specifically configured to determine the structure of the target code corresponding to the business to be processed according to the code generation rule; and generate a code generation tool corresponding to the code generation rule according to the structure of the target code corresponding to the business to be processed.

可选的,生成单元503,具体用于将多个抽象化参数中,处于表格的表头位置的抽象化参数确定为多个目标抽象化参数;根据多个目标抽象化参数,生成待处理业务对应的代码生成规则。Optionally, the generating unit 503 is specifically configured to determine the abstraction parameter at the header position of the table among the plurality of abstraction parameters as a plurality of target abstraction parameters; generate the business to be processed according to the plurality of target abstraction parameters Corresponding code generation rules.

可选的,生成单元503,具体用于确定待处理业务的类型,待处理业务对应的目标代码的函数类型、目标代码的文件类型以及目标代码的实现方式;根据待处理业务的类型,目标代码的函数类型、目标代码的文件类型以及目标代码的运行规则,对代码生成规则进行更新,得到新的代码生成规则。Optionally, the generating unit 503 is specifically used to determine the type of the business to be processed, the function type of the target code corresponding to the business to be processed, the file type of the target code and the implementation mode of the target code; according to the type of the business to be processed, the target code The function type of the target code, the file type of the target code and the running rules of the target code are updated, and the code generation rules are updated to obtain new code generation rules.

可选的,处理单元502,具体用于对待处理业务进行解析,得到待处理业务对应的状态信息、条件信息以及执行动作信息;基于状态信息、条件信息以及执行动作信息,对待处理业务进行抽象化处理。Optionally, the processing unit 502 is specifically configured to analyze the to-be-processed business to obtain status information, condition information and execution action information corresponding to the to-be-processed business; abstract the to-be-processed business based on the status information, condition information and execution action information deal with.

本申请实施例提供的代码生成装置50,可以执行上述任一实施例中的代码生成方法的技术方案,其实现原理以及有益效果与代码生成方法的实现原理及有益效果类似,可参见代码生成方法的实现原理及有益效果,此处不再进行赘述。The code generation device 50 provided in the embodiment of the present application can implement the technical solutions of the code generation method in any of the above-mentioned embodiments, and its implementation principle and beneficial effects are similar to those of the code generation method, and reference may be made to the code generation method The realization principle and beneficial effects of , will not be repeated here.

图6为本申请实施例提供的另一种代码生成装置60的结构示意图,示例的,请参见图6所示,该代码生成装置60可以包括处理器601和存储器602;FIG. 6 is a schematic structural diagram of another code generation apparatus 60 provided by an embodiment of the present application. For example, please refer to FIG. 6 , the code generation apparatus 60 may include a processor 601 and a memory 602;

其中,in,

所述存储器602,用于存储计算机程序。The memory 602 is used to store computer programs.

所述处理器601,用于读取所述存储器602存储的计算机程序,并根据所述存储器602中的计算机程序执行上述任一实施例中的代码生成方法的技术方案。The processor 601 is configured to read the computer program stored in the memory 602, and execute the technical solution of the code generation method in any of the foregoing embodiments according to the computer program in the memory 602.

可选地,存储器602既可以是独立的,也可以跟处理器601集成在一起。当存储器602是独立于处理器601之外的器件时,代码生成装置60还可以包括:总线,用于连接存储器602和处理器601。Optionally, the memory 602 may be independent or integrated with the processor 601 . When the memory 602 is a device independent of the processor 601 , the code generation apparatus 60 may further include: a bus for connecting the memory 602 and the processor 601 .

可选地,本实施例还包括:通信接口,该通信接口可以通过总线与处理器601连接。处理器601可以控制通信接口来实现上述代码生成装置60的接收和发送的功能。Optionally, this embodiment further includes: a communication interface, where the communication interface can be connected to the processor 601 through a bus. The processor 601 can control the communication interface to realize the functions of receiving and transmitting of the code generating apparatus 60 described above.

本申请实施例所示的代码生成装置60,可以执行上述任一实施例中的代码生成方法的技术方案,其实现原理以及有益效果与代码生成方法的实现原理及有益效果类似,可参见代码生成方法的实现原理及有益效果,此处不再进行赘述。The code generation device 60 shown in the embodiment of the present application can implement the technical solution of the code generation method in any of the above-mentioned embodiments, and its implementation principle and beneficial effects are similar to those of the code generation method. The realization principle and beneficial effects of the method will not be repeated here.

本申请实施例还提供一种计算机可读存储介质,该计算机可读存储介质中存储有计算机执行指令,当处理器执行所述计算机执行指令时,实现上述任一实施例中的代码生成方法的技术方案,其实现原理以及有益效果与代码生成方法的实现原理及有益效果类似,可参见代码生成方法的实现原理及有益效果,此处不再进行赘述。Embodiments of the present application further provide a computer-readable storage medium, where computer-executable instructions are stored in the computer-readable storage medium, and when a processor executes the computer-executable instructions, the code generation method in any of the foregoing embodiments is implemented. The implementation principle and beneficial effects of the technical solution are similar to those of the code generation method, and reference may be made to the implementation principle and beneficial effects of the code generation method, which will not be repeated here.

本申请实施例还提供了一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行时,实现上述任一实施例中的代码生成方法的技术方案,其实现原理以及有益效果与代码生成方法的实现原理及有益效果类似,可参见代码生成方法的实现原理及有益效果,此处不再进行赘述。Embodiments of the present application also provide a computer program product, including a computer program, when the computer program is executed by a processor, a technical solution for implementing the code generation method in any of the foregoing embodiments, its implementation principle, beneficial effects, and code generation The implementation principle and beneficial effects of the method are similar, and reference may be made to the implementation principle and beneficial effects of the code generation method, which will not be repeated here.

在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所展示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元展示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。The units described as separate components may or may not be physically separated, and components shown as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment. In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware, or may be implemented in the form of hardware plus software functional units.

上述以软件功能模块的形式实现的集成的模块,可以存储在一个计算机可读取存储介质中。上述软件功能模块存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(英文:processor)执行本申请各个实施例方法的部分步骤。The above-mentioned integrated modules implemented in the form of software functional modules may be stored in a computer-readable storage medium. The above-mentioned software function modules are stored in a storage medium, and include several instructions to enable a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to execute the methods of the various embodiments of the present application. some steps.

应理解的是,上述处理器可以是中央处理单元(英文:Central Processing Unit,简称:CPU),还可以是其他通用处理器、数字信号处理器(英文:Digital SignalProcessor,简称:DSP)、专用集成电路(英文:Application Specific IntegratedCircuit,简称:ASIC)等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合发明所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。It should be understood that the above-mentioned processor may be a central processing unit (English: Central Processing Unit, referred to as: CPU), or other general-purpose processors, digital signal processors (English: Digital SignalProcessor, referred to as: DSP), dedicated integrated Circuit (English: Application Specific Integrated Circuit, referred to as: ASIC) and so on. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in conjunction with the invention can be directly embodied as executed by a hardware processor, or executed by a combination of hardware and software modules in the processor.

存储器可能包含高速RAM存储器,也可能还包括非易失性存储NVM,例如至少一个磁盘存储器,还可以为U盘、移动硬盘、只读存储器、磁盘或光盘等。The memory may include high-speed RAM memory, and may also include non-volatile storage NVM, such as at least one magnetic disk memory, and may also be a U disk, a removable hard disk, a read-only memory, a magnetic disk or an optical disk, and the like.

总线可以是工业标准体系结构(Industry Standard Architecture,ISA)总线、外部设备互连(Peripheral Component,PCI)总线或扩展工业标准体系结构(ExtendedIndustry Standard Architecture,EISA)总线等。总线可以分为地址总线、数据总线、控制总线等。为便于表示,本申请附图中的总线并不限定仅有一根总线或一种类型的总线。The bus may be an industry standard architecture (Industry Standard Architecture, ISA) bus, a Peripheral Component (Peripheral Component, PCI) bus, or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, or the like. The bus can be divided into address bus, data bus, control bus and so on. For convenience of representation, the buses in the drawings of the present application are not limited to only one bus or one type of bus.

上述计算机可读存储介质可以是由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。存储介质可以是通用或专用计算机能够存取的任何可用介质。The above computer readable storage medium can be implemented by any type of volatile or non-volatile storage devices or combinations thereof, such as static random access memory (SRAM), electrically erasable programmable read only memory (EEPROM) , Erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Magnetic Memory, Flash Memory, Magnetic Disk or Optical Disk. A storage medium can be any available medium that can be accessed by a general purpose or special purpose computer.

最后应说明的是:以上各实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述各实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: The technical solutions described in the foregoing embodiments can still be modified, or some or all of the technical features thereof can be equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the technical solutions of the embodiments of the present application. scope.

Claims (11)

1.一种代码生成方法,其特征在于,包括:1. a code generation method, is characterized in that, comprises: 接收代码生成指令;其中,所述代码生成指令中包括待处理业务的标识;Receive a code generation instruction; wherein, the code generation instruction includes the identifier of the business to be processed; 对所述待处理业务的标识指示的待处理业务进行抽象化处理,得到所述待处理业务对应的描述文件;其中,所述描述文件中包括多个抽象化参数以及各抽象化参数对应的参数值;Perform abstraction processing on the to-be-processed service indicated by the identifier of the to-be-processed service to obtain a description file corresponding to the to-be-processed service; wherein the description file includes multiple abstraction parameters and parameters corresponding to each abstraction parameter value; 根据所述多个抽象化参数以及所述各抽象化参数对应的参数值,生成所述待处理业务对应的目标代码;generating the target code corresponding to the service to be processed according to the plurality of abstraction parameters and the parameter values corresponding to the abstraction parameters; 输出所述待处理业务对应的目标代码。The target code corresponding to the service to be processed is output. 2.根据权利要求1所述的方法,其特征在于,所述根据所述多个抽象化参数以及所述各抽象化参数对应的参数值,生成所述待处理业务对应的目标代码,包括:2. The method according to claim 1, wherein the generating the target code corresponding to the business to be processed according to the plurality of abstraction parameters and the parameter values corresponding to the abstraction parameters comprises: 根据所述多个抽象化参数,生成所述待处理业务对应的代码生成规则;generating a code generation rule corresponding to the business to be processed according to the plurality of abstraction parameters; 根据所述代码生成规则生成所述代码生成规则对应的代码生成工具;Generate a code generation tool corresponding to the code generation rule according to the code generation rule; 根据所述描述文件和所述代码生成工具生成所述待处理业务对应的目标代码。The target code corresponding to the service to be processed is generated according to the description file and the code generation tool. 3.根据权利要求2所述的方法,其特征在于,所述根据所述描述文件和所述代码生成工具生成所述待处理业务对应的目标代码,包括:3. The method according to claim 2, wherein generating the target code corresponding to the business to be processed according to the description file and the code generation tool comprises: 将所述描述文件导入至所述代码生成工具中,生成所述待处理业务对应的目标代码。Import the description file into the code generation tool to generate target code corresponding to the business to be processed. 4.根据权利要求2所述的方法,其特征在于,所述根据所述代码生成规则生成所述代码生成规则对应的代码生成工具,包括:4. The method according to claim 2, wherein generating a code generation tool corresponding to the code generation rule according to the code generation rule, comprising: 根据所述代码生成规则,确定所述待处理业务对应的目标代码的架构;According to the code generation rule, determine the structure of the target code corresponding to the business to be processed; 根据所述待处理业务对应的目标代码的架构,生成所述代码生成规则对应的代码生成工具。According to the structure of the target code corresponding to the business to be processed, a code generation tool corresponding to the code generation rule is generated. 5.根据权利要求2所述的方法,其特征在于,所述描述文件为表格,所述根据所述多个抽象化参数,生成所述待处理业务对应的代码生成规则,包括:5. The method according to claim 2, wherein the description file is a table, and the code generation rule corresponding to the business to be processed is generated according to the plurality of abstraction parameters, comprising: 将所述多个抽象化参数中,处于所述表格的表头位置的抽象化参数确定为多个目标抽象化参数;Determining, among the plurality of abstraction parameters, the abstraction parameter at the header position of the table as a plurality of target abstraction parameters; 根据所述多个目标抽象化参数,生成所述待处理业务对应的代码生成规则。According to the multiple target abstraction parameters, a code generation rule corresponding to the to-be-processed service is generated. 6.根据权利要求5所述的方法,其特征在于,所述方法还包括:6. The method according to claim 5, wherein the method further comprises: 确定所述待处理业务的类型,所述待处理业务对应的目标代码的函数类型、所述目标代码的文件类型以及所述目标代码的实现方式;Determine the type of the service to be processed, the function type of the target code corresponding to the service to be processed, the file type of the target code, and the implementation mode of the target code; 根据所述待处理业务的类型,所述目标代码的函数类型、所述目标代码的文件类型以及所述目标代码的运行规则,对所述代码生成规则进行更新,得到新的代码生成规则。According to the type of the service to be processed, the function type of the target code, the file type of the target code, and the running rule of the target code, the code generation rule is updated to obtain a new code generation rule. 7.根据权利要求1-6任一项所述的方法,其特征在于,所述对所述待处理业务的标识指示的待处理业务进行抽象化处理,包括:7. The method according to any one of claims 1-6, wherein the abstracting processing of the to-be-processed service indicated by the identifier of the to-be-processed service comprises: 对所述待处理业务进行解析,得到所述待处理业务对应的状态信息、条件信息以及执行动作信息;Analyzing the to-be-processed service to obtain status information, condition information and execution action information corresponding to the to-be-processed service; 基于所述状态信息、所述条件信息以及所述执行动作信息,对所述待处理业务进行抽象化处理。Based on the state information, the condition information, and the execution action information, abstract processing is performed on the to-be-processed service. 8.一种代码生成装置,其特征在于,包括:8. a code generation device, is characterized in that, comprises: 接收单元,用于接收代码生成指令;其中,所述代码生成指令中包括待处理业务的标识;a receiving unit for receiving a code generation instruction; wherein, the code generation instruction includes an identifier of a business to be processed; 处理单元,用于对所述待处理业务的标识指示的待处理业务进行抽象化处理,得到所述待处理业务对应的描述文件;其中,所述描述文件中包括多个抽象化参数以及各抽象化参数对应的参数值;A processing unit, configured to perform abstract processing on the to-be-processed service indicated by the identifier of the to-be-processed service, and obtain a description file corresponding to the to-be-processed service; wherein, the description file includes a plurality of abstraction parameters and each abstraction The parameter value corresponding to the parameterization parameter; 生成单元,用于根据所述多个抽象化参数以及所述各抽象化参数对应的参数值,生成所述待处理业务对应的目标代码;a generating unit, configured to generate the target code corresponding to the service to be processed according to the plurality of abstraction parameters and the parameter values corresponding to the abstraction parameters; 输出单元,用于输出所述待处理业务对应的目标代码。The output unit is used for outputting the target code corresponding to the service to be processed. 9.一种代码生成装置,其特征在于,包括存储器和处理器;其中,9. A code generation device, comprising a memory and a processor; wherein, 所述存储器,用于存储计算机程序;the memory for storing computer programs; 所述处理器,用于读取所述存储器存储的计算机程序,并根据所述存储器中的计算机程序执行上述权利要求1-7任一项所述的一种代码生成方法。The processor is configured to read the computer program stored in the memory, and execute a code generation method according to any one of the preceding claims 1-7 according to the computer program in the memory. 10.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机执行指令,当处理器执行所述计算机执行指令时,实现上述权利要求1-7任一项所述的一种代码生成方法。10. A computer-readable storage medium, wherein computer-executable instructions are stored in the computer-readable storage medium, and when a processor executes the computer-executable instructions, any one of the above claims 1-7 is implemented. A code generation method described. 11.一种计算机程序产品,包括计算机程序,其特征在于,该计算机程序被处理器执行时,实现上述权利要求1-7任一项所述的一种代码生成方法。11. A computer program product, comprising a computer program, characterized in that, when the computer program is executed by a processor, a code generation method according to any one of the preceding claims 1-7 is implemented.
CN202110111200.4A 2021-01-27 2021-01-27 Code generation method and device Pending CN112835564A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110111200.4A CN112835564A (en) 2021-01-27 2021-01-27 Code generation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110111200.4A CN112835564A (en) 2021-01-27 2021-01-27 Code generation method and device

Publications (1)

Publication Number Publication Date
CN112835564A true CN112835564A (en) 2021-05-25

Family

ID=75931883

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110111200.4A Pending CN112835564A (en) 2021-01-27 2021-01-27 Code generation method and device

Country Status (1)

Country Link
CN (1) CN112835564A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113296789A (en) * 2021-06-16 2021-08-24 北京有竹居网络技术有限公司 Code generation method, device, equipment and storage medium
CN115686676A (en) * 2022-11-04 2023-02-03 北京远舢智能科技有限公司 Dynamic calling method and device of object and electronic equipment

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7761848B1 (en) * 2005-03-15 2010-07-20 Open Invention Network, Llc Code generator tool for building software applications with reusable components
US20110265061A1 (en) * 2010-04-27 2011-10-27 Verizon Patent And Licensing Inc. Code generation
CN103473108A (en) * 2013-08-12 2013-12-25 福建富士通信息软件有限公司 Java code generating method
US20150262127A1 (en) * 2014-03-17 2015-09-17 Carsten Ziegler Generation and optimzation of in-memory database business rule logic
CN106874019A (en) * 2017-03-17 2017-06-20 微梦创科网络科技(中国)有限公司 The generation method and skeletal code maker of a kind of skeletal code
CN106919434A (en) * 2017-03-22 2017-07-04 恒生电子股份有限公司 A kind of code generating method and device
CN109522013A (en) * 2018-11-08 2019-03-26 网宿科技股份有限公司 A kind of code generating method and device of business function
CN110297632A (en) * 2019-06-12 2019-10-01 百度在线网络技术(北京)有限公司 Code generating method and device
CN110955410A (en) * 2019-10-23 2020-04-03 山东中创软件工程股份有限公司 Automatic code generation method, device, equipment and medium
CN111596915A (en) * 2020-05-19 2020-08-28 西安电子科技大学 C++ code generation method for UAV flight mode based on state machine diagram
CN111722839A (en) * 2020-06-24 2020-09-29 北京航天数据股份有限公司 Code generation method and device, electronic equipment and storage medium

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7761848B1 (en) * 2005-03-15 2010-07-20 Open Invention Network, Llc Code generator tool for building software applications with reusable components
US20110265061A1 (en) * 2010-04-27 2011-10-27 Verizon Patent And Licensing Inc. Code generation
CN103473108A (en) * 2013-08-12 2013-12-25 福建富士通信息软件有限公司 Java code generating method
US20150262127A1 (en) * 2014-03-17 2015-09-17 Carsten Ziegler Generation and optimzation of in-memory database business rule logic
CN106874019A (en) * 2017-03-17 2017-06-20 微梦创科网络科技(中国)有限公司 The generation method and skeletal code maker of a kind of skeletal code
CN106919434A (en) * 2017-03-22 2017-07-04 恒生电子股份有限公司 A kind of code generating method and device
CN109522013A (en) * 2018-11-08 2019-03-26 网宿科技股份有限公司 A kind of code generating method and device of business function
CN110297632A (en) * 2019-06-12 2019-10-01 百度在线网络技术(北京)有限公司 Code generating method and device
CN110955410A (en) * 2019-10-23 2020-04-03 山东中创软件工程股份有限公司 Automatic code generation method, device, equipment and medium
CN111596915A (en) * 2020-05-19 2020-08-28 西安电子科技大学 C++ code generation method for UAV flight mode based on state machine diagram
CN111722839A (en) * 2020-06-24 2020-09-29 北京航天数据股份有限公司 Code generation method and device, electronic equipment and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113296789A (en) * 2021-06-16 2021-08-24 北京有竹居网络技术有限公司 Code generation method, device, equipment and storage medium
CN115686676A (en) * 2022-11-04 2023-02-03 北京远舢智能科技有限公司 Dynamic calling method and device of object and electronic equipment
CN115686676B (en) * 2022-11-04 2023-07-28 北京远舢智能科技有限公司 Dynamic calling method and device for object and electronic equipment

Similar Documents

Publication Publication Date Title
CN111428462B (en) Communication protocol template construction method and terminal equipment
CN109976761B (en) Software development kit generation method and device and terminal equipment
CN107368593B (en) Data import method and device and server
TWI844091B (en) Feature matching rule construction, feature matching method, device, equipment and medium
CN109815141B (en) Test method and device
CN112835564A (en) Code generation method and device
EP4231138A1 (en) Method and apparatus for fixing weak memory ordering problem
CN111260433A (en) Service order processing method and device
CN108345458A (en) A kind of call method and system of static compilation language and script
CN116775114A (en) Version library compatibility determining method and device, computer equipment and storage medium
CN102789418B (en) Functional processor realistic model generating apparatus, method and function verification method
CN117573139A (en) Code automatic generation method, device, equipment and medium
CN102750167B (en) Application program launching method, device and computer system
CN115755867A (en) Vehicle diagnosis method and related device
CN112737831A (en) Firmware upgrade package processing method and device, electronic equipment and storage medium
CN112199224A (en) Analysis method and device of crash file, electronic equipment and storage medium
CN113302587A (en) Resource analysis method and device for assembly instruction and storage medium
CN117311757B (en) VDC firmware upgrade method, device, equipment and medium based on continuous integration
CN103761247A (en) Processing method and device for error files
WO2024250787A1 (en) Application processing method, apparatus, and system and related device
CN117348997A (en) Image processing pipeline generation method, device, equipment and medium
CN115964075A (en) Application export and import method and device, computer equipment and storage medium
CN118585453A (en) Code automation testing method, system, computer equipment and storage medium
CN115686622A (en) Task queue design method, system, terminal and storage medium
CN115186271A (en) Information writing method and terminal of MCU (microprogrammed control Unit) firmware

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