CN115981663A - Method and system for generating intermediate code based on flexible combination mode - Google Patents
Method and system for generating intermediate code based on flexible combination mode Download PDFInfo
- Publication number
- CN115981663A CN115981663A CN202310030774.8A CN202310030774A CN115981663A CN 115981663 A CN115981663 A CN 115981663A CN 202310030774 A CN202310030774 A CN 202310030774A CN 115981663 A CN115981663 A CN 115981663A
- Authority
- CN
- China
- Prior art keywords
- file
- input
- create
- intermediate code
- template
- 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
Links
Images
Classifications
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Stored Programmes (AREA)
Abstract
本发明涉及软件工程技术领域,具体为一种基于灵活组合方式的中间代码生成方法包括以下步骤:分析需要批量生成的目标文件;搭建本发明所需要的JDK环境;根据业务内容,创建文本模板;组织业务内容输入文件;按照三列结构进行生成规则设定;读取规则文件,创建规则List,迭代List,读入输入文件、模板文件内容;有益效果为:本发明提出的基于灵活组合方式的中间代码生成方法及系统通过本发明,提高软件工程中中间文本生成的效率,提升开发效率、部署效率、运维效率。操作模式灵活可配置,便于复用和临时调整。可重复执行性强,低成本维护,复用性高。
The present invention relates to the technical field of software engineering, specifically a method for generating an intermediate code based on a flexible combination method comprising the following steps: analyzing target files that need to be generated in batches; building the JDK environment required by the present invention; creating a text template according to business content; Organize the business content input file; set the generation rules according to the three-column structure; read the rule file, create a rule List, iterate the List, and read the content of the input file and template file; the beneficial effect is: the flexible combination method proposed by the present invention The intermediate code generation method and system improve the efficiency of intermediate text generation in software engineering, and improve development efficiency, deployment efficiency, and operation and maintenance efficiency through the present invention. The operation mode is flexible and configurable, which is convenient for reuse and temporary adjustment. Strong repeatability, low-cost maintenance, and high reusability.
Description
技术领域technical field
本发明涉及软件工程技术领域,具体为一种基于灵活组合方式的中间代码生成方法及系统。The invention relates to the technical field of software engineering, in particular to an intermediate code generation method and system based on a flexible combination mode.
背景技术Background technique
针对软件开发、实施、运维过程中,需要批量处理数据的业务场景。For business scenarios that require batch processing of data during software development, implementation, and operation and maintenance.
现有技术中,从文本转化为结构化的计算机可以识别处理的信息,使计算机能够通过对这种模型的计算和操作来实现对文本的识别;读取输入文件列表、模板文件列表,以文件流的方式基于生成规则,生成模板文本数据;使用路由规则技术,配置目标文件的生成方式。In the prior art, the computer can identify and process the information converted from text into structure, so that the computer can realize the recognition of the text through the calculation and operation of this model; read the input file list, the template file list, and use the file The flow method is based on the generation rules to generate template text data; use the routing rule technology to configure the generation method of the target file.
但是,软件工程中创建业务所需要的批量文本的能力低,软件工程中中间文本生成的效率低,开发效率、部署效率、运维效率普遍低下。However, the ability to create batches of text required for business in software engineering is low, the efficiency of intermediate text generation in software engineering is low, and the efficiency of development, deployment, and operation and maintenance is generally low.
发明内容Contents of the invention
本发明的目的在于提供一种基于灵活组合方式的中间代码生成方法及系统,以解决上述背景技术中提出的问题。The object of the present invention is to provide a method and system for generating intermediate codes based on a flexible combination mode, so as to solve the problems raised in the above-mentioned background technology.
为实现上述目的,本发明提供如下技术方案:一种基于灵活组合方式的中间代码生成方法,所该中间代码生成方法包括以下步骤:In order to achieve the above object, the present invention provides the following technical solutions: a method for generating an intermediate code based on a flexible combination mode, so the method for generating the intermediate code comprises the following steps:
分析需要批量生成的目标文件;Analyze the target files that need to be generated in batches;
搭建本发明所需要的JDK环境;Build the required JDK environment of the present invention;
根据业务内容,创建文本模板;Create text templates based on business content;
组织业务内容输入文件;Organize business content input files;
按照三列结构进行生成规则设定;Set the generation rules according to the three-column structure;
读取规则文件,创建规则List,迭代List,读入输入文件、模板文件内容。Read the rule file, create a rule list, iterate the list, and read the content of the input file and template file.
优选的,在软件工程中,根据业务需求,分析需要批量生成的目标文件,将业务划分为业务输入文件、文件模板、生成规则;Preferably, in software engineering, according to business requirements, analyze the target files that need to be generated in batches, and divide the business into business input files, file templates, and generation rules;
搭建本发明所需要的JDK环境,和中间代码生成工具ATT.JAR,按照INPUT、OUTPUT、TEMPLATE的结构创建运行目录。Set up the JDK environment required by the present invention, and the intermediate code generation tool ATT.JAR, and create a running directory according to the structure of INPUT, OUTPUT, and TEMPLATE.
优选的,根据业务内容,创建文本模板;使用${VALUE_NAME}结构对宏替换内容进行设置;Preferably, create a text template according to the business content; use the ${VALUE_NAME} structure to set the macro replacement content;
业务内容采用CSV格式。The business content is in CSV format.
优选的,按照三列结构进行生成规则设定,第一列是输入文件,第二列是模板文件,第三列是输出文件,可以任意的交叉组合。Preferably, the generation rules are set according to a three-column structure, the first column is the input file, the second column is the template file, and the third column is the output file, which can be cross-combined arbitrarily.
优选的,读取规则文件,创建规则List,迭代List,读入输入文件、模板文件内容;创建输出对象PrintStream,将输入文件的CSV结构,转化为含Key-Value的List结构,遍历每一个Map中的KeySet中的k,替换${"+k+"}为map.get(k)。根据输出文件是否已存在,决定是append还是create的方式来输出。Preferably, read the rule file, create a rule List, iterate the List, read in the content of the input file and the template file; create an output object PrintStream, convert the CSV structure of the input file into a List structure containing Key-Value, and traverse each Map For k in KeySet, replace ${"+k+"} with map.get(k). Depending on whether the output file already exists, decide whether to append or create to output.
一种基于灵活组合方式的中间代码生成系统,该系统由分析模块、环境搭建模块、模板创建模块、文件输入模块、规则设定模块以及执行模块构成;An intermediate code generation system based on a flexible combination method, the system is composed of an analysis module, an environment construction module, a template creation module, a file input module, a rule setting module and an execution module;
分析模块,用于分析需要批量生成的目标文件;The analysis module is used to analyze the target files that need to be generated in batches;
环境搭建模块,用于搭建本发明所需要的JDK环境;The environment building module is used to build the JDK environment required by the present invention;
模板创建模块,用于根据业务内容,创建文本模板;Template creation module, used to create text templates according to business content;
文件输入模块,用于组织业务内容输入文件;The file input module is used to organize business content input files;
规则设定模块,用于按照三列结构进行生成规则设定;The rule setting module is used to set the generation rules according to the three-column structure;
执行模块,读取规则文件,创建规则List,迭代List,读入输入文件、模板文件内容。Execute the module, read the rule file, create a rule list, iterate the list, and read the content of the input file and template file.
优选的,所述分析模块中,在软件工程中,根据业务需求,分析需要批量生成的目标文件,将业务划分为业务输入文件、文件模板、生成规则;Preferably, in the analysis module, in software engineering, according to business requirements, analyze the target files that need to be generated in batches, and divide the business into business input files, file templates, and generation rules;
环境搭建模块中,搭建本发明所需要的JDK环境,和中间代码生成工具ATT.JAR,按照INPUT、OUTPUT、TEMPLATE的结构创建运行目录。In the environment building module, build the JDK environment required by the present invention, and the intermediate code generation tool ATT.JAR, and create a running directory according to the structure of INPUT, OUTPUT, and TEMPLATE.
优选的,所述模板创建模块中,根据业务内容,创建文本模板;使用${VALUE_NAME}结构对宏替换内容进行设置;Preferably, in the template creation module, a text template is created according to the business content; the macro replacement content is set using the ${VALUE_NAME} structure;
文件输入模块中,业务内容采用CSV格式。In the file input module, the business content adopts CSV format.
优选的,所述规则设定模块中,按照三列结构进行生成规则设定,第一列是输入文件,第二列是模板文件,第三列是输出文件,可以任意的交叉组合。Preferably, in the rule setting module, the generation rules are set according to a three-column structure, the first column is the input file, the second column is the template file, and the third column is the output file, which can be cross-combined arbitrarily.
优选的,所述执行模块中,读取规则文件,创建规则List,迭代List,读入输入文件、模板文件内容;创建输出对象PrintStream,将输入文件的CSV结构,转化为含Key-Value的List结构,遍历每一个Map中的KeySet中的k,替换${"+k+"}为map.get(k)。根据输出文件是否已存在,决定是append还是create的方式来输出。Preferably, in the execution module, the rule file is read, the rule List is created, the List is iterated, and the input file and template file content are read in; the output object PrintStream is created, and the CSV structure of the input file is converted into a List containing Key-Value Structure, traverse the k in the KeySet in each Map, and replace ${"+k+"} with map.get(k). Depending on whether the output file already exists, decide whether to append or create to output.
与现有技术相比,本发明的有益效果是:Compared with prior art, the beneficial effect of the present invention is:
本发明提出的基于灵活组合方式的中间代码生成方法及系统通过本发明,提高软件工程中中间文本生成的效率,提升开发效率、部署效率、运维效率。操作模式灵活可配置,便于复用和临时调整。可重复执行性强,低成本维护,复用性高。The intermediate code generation method and system based on the flexible combination mode proposed by the present invention can improve the efficiency of intermediate text generation in software engineering, improve development efficiency, deployment efficiency, and operation and maintenance efficiency. The operation mode is flexible and configurable, which is convenient for reuse and temporary adjustment. Strong repeatability, low maintenance cost, and high reusability.
附图说明Description of drawings
图1为本发明方法原理示意图。Figure 1 is a schematic diagram of the principle of the method of the present invention.
具体实施方式Detailed ways
为了使本发明的目的、技术方案进行清楚、完整地描述,及优点更加清楚明白,以下结合附图对本发明实施例进行进一步详细说明。应当理解,此处所描述的具体实施例是本发明一部分实施例,而不是全部的实施例,仅仅用以解释本发明实施例,并不用于限定本发明实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to clearly and completely describe the purpose, technical solution, and advantages of the present invention, the embodiments of the present invention will be further described in detail below in conjunction with the accompanying drawings. It should be understood that the specific embodiments described here are some, not all, embodiments of the present invention, and are only used to explain the embodiments of the present invention, and are not intended to limit the embodiments of the present invention. All other embodiments obtained under the premise of creative work all belong to the protection scope of the present invention.
实施例一Embodiment one
请参阅图1,本发明提供一种技术方案:一种基于灵活组合方式的中间代码生成方法,所该中间代码生成方法包括以下步骤:Please refer to Fig. 1, the present invention provides a kind of technical scheme: a kind of intermediate code generation method based on flexible combination mode, so this intermediate code generation method comprises the following steps:
分析需要批量生成的目标文件;在软件工程中,根据业务需求,分析需要批量生成的目标文件,将业务划分为业务输入文件、文件模板、生成规则;Analyze the target files that need to be generated in batches; in software engineering, according to business requirements, analyze the target files that need to be generated in batches, and divide the business into business input files, file templates, and generation rules;
搭建本发明所需要的JDK环境;搭建本发明所需要的JDK环境,和中间代码生成工具ATT.JAR,按照INPUT、OUTPUT、TEMPLATE的结构创建运行目录;Build the required JDK environment of the present invention; Build the required JDK environment of the present invention, and intermediate code generation tool ATT.JAR, create the running directory according to the structure of INPUT, OUTPUT, TEMPLATE;
根据业务内容,创建文本模板;根据业务内容,创建文本模板;使用${VALUE_NAME}结构对宏替换内容进行设置;Create a text template according to the business content; create a text template according to the business content; use the ${VALUE_NAME} structure to set the macro replacement content;
组织业务内容输入文件;业务内容采用CSV格式;Organize business content input files; business content adopts CSV format;
按照三列结构进行生成规则设定;按照三列结构进行生成规则设定,第一列是输入文件,第二列是模板文件,第三列是输出文件,可以任意的交叉组合;Set the generation rules according to the three-column structure; set the generation rules according to the three-column structure, the first column is the input file, the second column is the template file, and the third column is the output file, which can be cross-combined arbitrarily;
读取规则文件,创建规则List,迭代List,读入输入文件、模板文件内容;读取规则文件,创建规则List,迭代List,读入输入文件、模板文件内容;创建输出对象PrintStream,将输入文件的CSV结构,转化为含Key-Value的List结构,遍历每一个Map中的KeySet中的k,替换${"+k+"}为map.get(k);根据输出文件是否已存在,决定是append还是create的方式来输出。Read rule file, create rule List, iterate List, read input file, template file content; read rule file, create rule List, iterate List, read input file, template file content; create output object PrintStream, input file Convert the CSV structure into a List structure containing Key-Value, traverse the k in the KeySet in each Map, and replace ${"+k+"} with map.get(k); according to whether the output file already exists, the decision is append or create to output.
实施例二Embodiment two
一种基于灵活组合方式的中间代码生成系统,该系统由分析模块、环境搭建模块、模板创建模块、文件输入模块、规则设定模块以及执行模块构成;An intermediate code generation system based on a flexible combination method, the system is composed of an analysis module, an environment construction module, a template creation module, a file input module, a rule setting module and an execution module;
分析模块,用于分析需要批量生成的目标文件;在软件工程中,根据业务需求,分析需要批量生成的目标文件,将业务划分为业务输入文件、文件模板、生成规则;The analysis module is used to analyze the target files that need to be generated in batches; in software engineering, according to business requirements, analyze the target files that need to be generated in batches, and divide the business into business input files, file templates, and generation rules;
环境搭建模块,用于搭建本发明所需要的JDK环境;搭建本发明所需要的JDK环境,和中间代码生成工具ATT.JAR,按照INPUT、OUTPUT、TEMPLATE的结构创建运行目录;Environment builds module, is used to set up the JDK environment that the present invention needs; Set up the JDK environment that the present invention needs, and intermediate code generation tool ATT.JAR, creates operation directory according to the structure of INPUT, OUTPUT, TEMPLATE;
模板创建模块,用于根据业务内容,创建文本模板;根据业务内容,创建文本模板;使用${VALUE_NAME}结构对宏替换内容进行设置;The template creation module is used to create a text template according to the business content; create a text template according to the business content; use the ${VALUE_NAME} structure to set the macro replacement content;
文件输入模块,用于组织业务内容输入文件;文件输入模块中,业务内容采用CSV格式;The file input module is used to organize business content input files; in the file input module, the business content adopts CSV format;
规则设定模块,用于按照三列结构进行生成规则设定;按照三列结构进行生成规则设定,第一列是输入文件,第二列是模板文件,第三列是输出文件,可以任意的交叉组合;The rule setting module is used to set the generation rules according to the three-column structure; the generation rules are set according to the three-column structure, the first column is the input file, the second column is the template file, and the third column is the output file, which can be arbitrarily cross combination;
执行模块,读取规则文件,创建规则List,迭代List,读入输入文件、模板文件内容;读取规则文件,创建规则List,迭代List,读入输入文件、模板文件内容;创建输出对象PrintStream,将输入文件的CSV结构,转化为含Key-Value的List结构,遍历每一个Map中的KeySet中的k,替换${"+k+"}为map.get(k)。根据输出文件是否已存在,决定是append还是create的方式来输出。Execution module, read rule file, create rule List, iterate List, read input file, template file content; read rule file, create rule List, iterate List, read input file, template file content; create output object PrintStream, Convert the CSV structure of the input file into a List structure containing Key-Value, traverse the k in the KeySet in each Map, and replace ${"+k+"} with map.get(k). Depending on whether the output file already exists, decide whether to append or create to output.
尽管已经示出和描述了本发明的实施例,对于本领域的普通技术人员而言,可以理解在不脱离本发明的原理和精神的情况下可以对这些实施例进行多种变化、修改、替换和变型,本发明的范围由所附权利要求及其等同物限定。Although the embodiments of the present invention have been shown and described, those skilled in the art can understand that various changes, modifications and substitutions can be made to these embodiments without departing from the principle and spirit of the present invention. and modifications, the scope of the invention is defined by the appended claims and their equivalents.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310030774.8A CN115981663A (en) | 2023-01-10 | 2023-01-10 | Method and system for generating intermediate code based on flexible combination mode |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310030774.8A CN115981663A (en) | 2023-01-10 | 2023-01-10 | Method and system for generating intermediate code based on flexible combination mode |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN115981663A true CN115981663A (en) | 2023-04-18 |
Family
ID=85970087
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202310030774.8A Pending CN115981663A (en) | 2023-01-10 | 2023-01-10 | Method and system for generating intermediate code based on flexible combination mode |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN115981663A (en) |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20110265061A1 (en) * | 2010-04-27 | 2011-10-27 | Verizon Patent And Licensing Inc. | Code generation |
| CN109343835A (en) * | 2018-08-28 | 2019-02-15 | 苏州浪潮智能软件有限公司 | A kind of rapid build business scaffold code instrumentation based on template |
| CN109656543A (en) * | 2018-12-21 | 2019-04-19 | 苏州绿控传动科技股份有限公司 | A kind of real time workshop method based on document keyword replacement |
| CN109976803A (en) * | 2017-12-27 | 2019-07-05 | 航天信息股份有限公司 | A kind of generation method and device of file |
| CN110825369A (en) * | 2019-11-07 | 2020-02-21 | 四川长虹电器股份有限公司 | Method for automatically generating codes based on java language |
| CN114461206A (en) * | 2022-01-19 | 2022-05-10 | 北京致远互联软件股份有限公司 | Declarative code generation compiling execution method |
-
2023
- 2023-01-10 CN CN202310030774.8A patent/CN115981663A/en active Pending
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20110265061A1 (en) * | 2010-04-27 | 2011-10-27 | Verizon Patent And Licensing Inc. | Code generation |
| CN109976803A (en) * | 2017-12-27 | 2019-07-05 | 航天信息股份有限公司 | A kind of generation method and device of file |
| CN109343835A (en) * | 2018-08-28 | 2019-02-15 | 苏州浪潮智能软件有限公司 | A kind of rapid build business scaffold code instrumentation based on template |
| CN109656543A (en) * | 2018-12-21 | 2019-04-19 | 苏州绿控传动科技股份有限公司 | A kind of real time workshop method based on document keyword replacement |
| CN110825369A (en) * | 2019-11-07 | 2020-02-21 | 四川长虹电器股份有限公司 | Method for automatically generating codes based on java language |
| CN114461206A (en) * | 2022-01-19 | 2022-05-10 | 北京致远互联软件股份有限公司 | Declarative code generation compiling execution method |
Non-Patent Citations (1)
| Title |
|---|
| 赵跃华;王凌;: "基于敏捷方式的Java代码生成方法的设计", 计算机工程与设计, no. 12, 28 June 2009 (2009-06-28) * |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN105069033B (en) | A kind of method and device for creating database table model | |
| CN112905450B (en) | Chip register automatic development system based on template variable replacement | |
| CN104049976B (en) | Interlocking software automatic creation system based on Boolean logic | |
| CN104657274B (en) | software interface test method and device | |
| CN106874244A (en) | A kind of construction method of the document Auto-generation Model based on work sequence | |
| CN104007984B (en) | A method and device for converting data | |
| CN112527272B (en) | Method for docking TVM (transient voltage management) and related equipment | |
| CN111967084A (en) | Parameterized modeling method and system based on data-driven assembly type steel structure | |
| CN108509284A (en) | A kind of tree shaped model task management system applied to functional expression programming | |
| CN112037003A (en) | File account checking processing method and device | |
| CN103077038B (en) | The method of dynamic generation and compiling .NET project | |
| CN105117430A (en) | Repetitive task process discovery method based on equivalence class | |
| CN101553779B (en) | Migration apparatus which convert application program of mainframe system into application program of open system and method for thereof | |
| CN115981663A (en) | Method and system for generating intermediate code based on flexible combination mode | |
| CN115146634A (en) | Processing method and related device for emergency plan transformation to-do flow chart | |
| CN110780863B (en) | Cross-platform development method, device, equipment and medium of storage system | |
| CN103810408A (en) | Method and device for generating permission object | |
| CN117709302B (en) | Document conversion method and device | |
| CN118819505A (en) | A data collection method and system for software engineering business data | |
| CN103279354B (en) | The automatic production generation method of DRC file and generator | |
| CN115544980A (en) | Method and device for generating document by Excel file based on Revit | |
| CN116244789A (en) | Coal preparation plant multi-specialty construction drawing entrustment raising method and device | |
| CN116702751A (en) | Formula processing method, device, equipment and storage medium based on artificial intelligence | |
| CN113947297A (en) | Formula conversion method and system based on template variables | |
| CN112989602B (en) | Method and system for generating CID model by mapping |
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 |
