[go: up one dir, main page]

CN102156655B - Senior language code generation method and generator - Google Patents

Senior language code generation method and generator Download PDF

Info

Publication number
CN102156655B
CN102156655B CN201110115605.1A CN201110115605A CN102156655B CN 102156655 B CN102156655 B CN 102156655B CN 201110115605 A CN201110115605 A CN 201110115605A CN 102156655 B CN102156655 B CN 102156655B
Authority
CN
China
Prior art keywords
level language
language code
tree
syntax
grammer
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.)
Expired - Fee Related
Application number
CN201110115605.1A
Other languages
Chinese (zh)
Other versions
CN102156655A (en
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.)
Peking University Shenzhen Graduate School
Original Assignee
Peking University Shenzhen Graduate School
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 Peking University Shenzhen Graduate School filed Critical Peking University Shenzhen Graduate School
Priority to CN201110115605.1A priority Critical patent/CN102156655B/en
Publication of CN102156655A publication Critical patent/CN102156655A/en
Application granted granted Critical
Publication of CN102156655B publication Critical patent/CN102156655B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

本发明公开了一种高级语言代码产生器及高级语言代码生成方法,通过将输入的EDA设计工具的语法支持情况描述信息和验证或测试策略分别转换为相应的语法配置表和控制约束表,再根据该语法配置表和控制约束表,调用相应的语法库构建语法树,再将该语法树转换为对应的可执行高级语言代码。由于构建的语法树满足语法配置表和控制约束表,保证了生成的高级语言代码的可执行性,并提高了代码的相关性,使得能够更自然地模拟实际算法代码,从而为保证各种EDA设计工具对各种代码描述的转换的正确性提供了优质的测试用例,且该测试用例可执行性良好,进而减轻了人工编写测试代码的压力。

Figure 201110115605

The invention discloses a high-level language code generator and a high-level language code generation method, by converting the input syntax support description information and verification or test strategies of an EDA design tool into corresponding syntax configuration tables and control constraint tables, and then According to the syntax configuration table and the control constraint table, the corresponding syntax library is called to construct a syntax tree, and then the syntax tree is converted into a corresponding executable high-level language code. Since the constructed syntax tree satisfies the syntax configuration table and the control constraint table, the executable of the generated high-level language code is guaranteed, and the correlation of the code is improved, so that the actual algorithm code can be simulated more naturally, so as to guarantee various EDA The design tool provides high-quality test cases for the correctness of the conversion described by various codes, and the test cases are well executable, thereby reducing the pressure of manually writing test codes.

Figure 201110115605

Description

高级语言代码的生成方法及其产生器High-level language code generation method and its generator

技术领域 technical field

本发明涉及电子设计自动化(Electronic Design Automation,EDA)软件工具的验证和自动代码生成领域,尤其涉及在高层次综合设计工具开发的验证流程中的一种高级语言代码产生器及高级语言代码生成方法。The present invention relates to the field of verification and automatic code generation of electronic design automation (Electronic Design Automation, EDA) software tools, in particular to a high-level language code generator and a high-level language code generation method in the verification process of high-level comprehensive design tool development .

背景技术 Background technique

集成电路设计的EDA技术开始于20世纪70年代。最早在电路设计方面出现了SPICE(Simulation program with integrated circuit emphasis,通用模拟电路仿真器),在版图制作方面由手工绘图转变为计算机绘图;20世纪80年代初出现了逻辑仿真器和自动布局布线工具;20世纪80年代末出现了RTL(RegisterTransfer Level,寄存器传输级)级设计仿真和逻辑综合工具,以及形式验证和静态时序分析工具;现在的第四代EDA工具主要包括:重复利用设计、图形的状态图输入、算法综合、软硬件互补设计等。EDA technology for integrated circuit design began in the 1970s. SPICE (Simulation program with integrated circuit emphasis, general-purpose analog circuit simulator) first appeared in circuit design, and changed from manual drawing to computer drawing in layout production; logic simulators and automatic layout and routing tools appeared in the early 1980s ; In the late 1980s, RTL (RegisterTransfer Level, register transfer level) level design simulation and logic synthesis tools, as well as formal verification and static timing analysis tools, appeared; the current fourth-generation EDA tools mainly include: reuse design, graphics State diagram input, algorithm synthesis, software and hardware complementary design, etc.

从EDA的发展趋势可以看出,现在的辅助设计逐渐向算法级和系统级转化。这也是为应对现在集成电路设计公司对快速开发和快速上市等需求的必然走向。随着算法描述抽象层次的提高,使用高级语言设计系统的优势更加明显,设计者可以快速而简洁地构建功能函数,通过标准库和函数调用技术,创建更复杂高速的系统。It can be seen from the development trend of EDA that the current aided design is gradually transforming to the algorithm level and system level. This is also an inevitable trend in response to the current needs of integrated circuit design companies for rapid development and rapid listing. With the improvement of the abstraction level of algorithm description, the advantages of using high-level language design system become more obvious. Designers can build functional functions quickly and concisely, and create more complex and high-speed systems through standard library and function call technology.

目前,EDA设计工具支持从高级语言的算法描述直接映射出对应的电路结构,但从高级语言算法描述映射到对应的电路结构过程中,通常难以保证在该EDA设计工具支持的高级语言语法范围内的各种形式的算法代码描述的正确转换。At present, EDA design tools support the direct mapping of the corresponding circuit structure from the algorithm description of the high-level language, but in the process of mapping from the algorithm description of the high-level language to the corresponding circuit structure, it is usually difficult to ensure that the high-level language syntax supported by the EDA design tool is within the range The various forms of algorithmic code describe the correct conversion.

发明内容 Contents of the invention

本发明要解决的主要技术问题是,提供一种高级语言代码产生器及高级语言代码生成方法,通过本发明的高级语言代码产生器,及高级语言代码产生方法生成的高级语言代码精简,有良好的相关性和随机性,使得更自然地模拟实际算法代码,从而提供测试或者验证时所需的符合要求的高级语言代码测试用例,并且保证产生的高级语言代码测试用例的直接可执行性,从而减轻了人工编写测试代码的压力。The main technical problem to be solved by the present invention is to provide a high-level language code generator and a high-level language code generation method. The correlation and randomness of the algorithm make it more natural to simulate the actual algorithm code, thereby providing the high-level language code test cases required for testing or verification, and ensuring the direct executable of the high-level language code test cases, so that Reduce the pressure of manually writing test code.

为解决上述技术问题,本发明采用的技术方案如下:In order to solve the problems of the technologies described above, the technical scheme adopted in the present invention is as follows:

一种高级语言代码产生器,包括:A high-level language code generator including:

语法配置模块,用于接收输入的电子设计自动化工具的语法支持情况描述信息,并将所述语法支持情况描述信息转换为相应的语法配置表;A syntax configuration module, configured to receive the syntax support description information of the input electronic design automation tool, and convert the syntax support description information into a corresponding syntax configuration table;

控制参数提取模块,用于接收输入的验证或者测试策略的策略级描述信息,并将所述验证或者测试策略的策略级描述信息转化为相应的控制约束表;A control parameter extraction module, configured to receive input verification or test strategy-level description information, and convert the verification or test strategy-level description information into a corresponding control constraint table;

高级语言语法库,用于将需要的高级语言的所有语法和词法元素描述进行存储;The high-level language grammar library is used to store all the grammar and lexical element descriptions of the high-level language required;

语法树生成模块,与所述语法配置模块、高级语言语法库和控制参数提取模块相连,用于根据所述语法配置模块生成的语法配置表,以及所述参数提取模块生成的控制约束表,调用所述高级语言语法库中的语法和词法元素,并生成相应的语法树;Syntax tree generating module, connected with the grammar configuration module, advanced language grammar library and control parameter extraction module, for the grammar configuration table generated according to the grammar configuration module, and the control constraint table generated by the parameter extraction module, calling Grammar and lexical elements in the high-level language grammar library, and generate a corresponding syntax tree;

代码生成模块,与所述语法树生成模块相连,用于将所述语法树生成模块生成的语法树转换为相应的可执行高级语言代码文件。A code generation module, connected to the syntax tree generation module, is used to convert the syntax tree generated by the syntax tree generation module into a corresponding executable high-level language code file.

进一步地,所述代码生成模块还用于根据所述语法树,生成对应于所述可执行高级语言代码文件的高级语言代码特性描述文件,则所述代码生成模块,包括:Further, the code generation module is also used to generate a high-level language code characteristic description file corresponding to the executable high-level language code file according to the syntax tree, then the code generation module includes:

代码构建子模块,与所述语法树生成模块相连,用于将所述语法树生成模块生成的语法树进行遍历读取,生成对应的可执行高级语言代码文件;The code construction sub-module is connected with the syntax tree generation module, and is used to traverse and read the syntax tree generated by the syntax tree generation module, and generate a corresponding executable high-level language code file;

代码特性提取子模块,与所述代码构建子模块和符合度检测模块相连,用于在所述代码构建子模块遍历读取所述语法树的同时记录产生的可执行高级语言代码的特性,并产生相应的高级语言代码特性描述文件。A code characteristic extraction submodule is connected to the code construction submodule and the conformity detection module, and is used to record the characteristics of the generated executable high-level language code while the code construction submodule traverses and reads the syntax tree, and Generate the corresponding high-level language code feature description file.

更进一步地,当用户需要特定标注或注释信息时,所述代码构建子模块还用于在标准语言基础上增加其他信息量标注的接口。Furthermore, when the user needs specific annotation or annotation information, the code construction sub-module is also used to add interfaces for other information volume annotations on the basis of the standard language.

更进一步地,所述高级语言代码产生器还包括:Further, the high-level language code generator also includes:

符合度检测模块,与所述代码特性提取子模块和控制参数提取模块相连,用于根据所述高级语言代码特性描述文件,以及所述控制约束表进行符合度核对,如果所述高级语言代码特性描述文件满足所述控制约束表,则生成相应的符合度报告,并输出所述符合度报告、可执行高级语言代码文件和高级代码特性描述文件;如果所述高级语言代码特性描述文件不满足所述控制约束表时,则根据预先设置的允许的迭代次数,自动调整内部设置,重新生成新的可执行高级语言代码文件。A compliance detection module, connected to the code feature extraction sub-module and the control parameter extraction module, for checking the compliance according to the high-level language code feature description file and the control constraint table, if the high-level language code feature The description file meets the control constraint table, then generates a corresponding compliance report, and outputs the compliance report, executable high-level language code file and high-level code feature description file; if the high-level language code feature description file does not meet the required When the above-mentioned control constraint table is used, the internal settings are automatically adjusted according to the preset allowable number of iterations, and a new executable high-level language code file is regenerated.

进一步地,所述语法树生成模块包括:Further, the syntax tree generation module includes:

子树集生成子模块,与所述语法配置模块、控制参数提取模块和高级语言语法库相连,用于根据所述语法配置表和控制约束表,以高级语言语法库中的语法或者词法元素的类标识或者实例为结点,生成相应的子树集;The subtree set generation submodule is connected with the grammar configuration module, the control parameter extraction module and the high-level language grammar library, and is used to use the grammar or lexical elements in the advanced language grammar library according to the grammar configuration table and the control constraint table. The class identifier or instance is a node, and the corresponding subtree set is generated;

子树合并子模块,与所述语法配置模块、控制参数提取模块和子树集生成子模块相连,用于根据所述语法配置表和控制约束表,随机将各子树进行合并,得到新的子树集,合并的条件为将要合并的两棵子树中的一棵子树的根结点与另一棵子树的叶结点类型相同;The subtree merging submodule is connected with the grammar configuration module, the control parameter extraction module and the subtree set generation submodule, and is used to randomly merge the subtrees according to the grammar configuration table and the control constraint table to obtain a new subtree Tree set, the condition for merging is that the root node of one of the two subtrees to be merged is the same type as the leaf node of the other subtree;

总语法树生成子模块,与所述子树合并子模块、语法配置模块和控制参数提取模块相连,用于将得到的新的子树集中结点最多的子树作为主树,其他子树作为附树,并根据所述语法配置表和控制约束表,按照自底向上延展的方向,随机对所述主树和附树进行多轮合并,得到对应的总语法树。The total syntax tree generation submodule is connected with the subtree merging submodule, syntax configuration module and control parameter extraction module, and is used to use the subtree with the most nodes in the obtained new subtree set as the main tree, and other subtrees as the main tree. The attached tree, and according to the grammar configuration table and the control constraint table, according to the direction of bottom-up extension, randomly perform multiple rounds of merging of the main tree and the attached tree to obtain the corresponding total grammar tree.

更进一步地,其特征在于,所述语法配置表包括:语法点支持信息、实现形式约束信息、特殊语法现象约束信息;所述控制约束表包括:程序的流程布局信息、变量使用信息。Further, it is characterized in that the syntax configuration table includes: syntax point support information, implementation form constraint information, and special syntax phenomenon constraint information; the control constraint table includes: program flow layout information, and variable usage information.

一种高级语言代码生成方法,包括:A high-level language code generation method comprising:

根据输入的电子设计自动化工具的语法支持情况描述信息,生成相应的语法配置表;Generate a corresponding syntax configuration table according to the description information of the syntax support of the input electronic design automation tool;

根据输入的验证或者测试策略的策略级描述信息,生成相应的控制约束表;According to the strategy-level description information of the input verification or test strategy, generate the corresponding control constraint table;

根据所述语法配置表和控制约束表,调用高级语言语法库内的语法和词法元素,并通过语法树构建方法构建相应的语法树;Call the syntax and lexical elements in the high-level language syntax library according to the syntax configuration table and the control constraint table, and construct a corresponding syntax tree through a syntax tree construction method;

将所述语法树转换为相应的可执行高级语言代码文件。The syntax tree is converted into a corresponding executable high-level language code file.

进一步地,将所述语法树转换为相应的可执行高级语言代码文件包括:Further, converting the syntax tree into a corresponding executable high-level language code file includes:

遍历读取所述语法树,生成相应的可执行高级语言代码文件;Traversing and reading the syntax tree to generate a corresponding executable high-level language code file;

当设定了特定标注或注释信息时,在所述可执行高级语言代码文件中生成对应于所述特定标注或注释信息的高级语言代码。When specific annotation or annotation information is set, high-level language codes corresponding to the specific annotation or annotation information are generated in the executable high-level language code file.

更进一步地,所述方法还包括:Further, the method also includes:

遍历读取所述语法树的同时,记录生成的可执行高级语言代码的特性,并生成相应的高级语言代码特性描述文件;While traversing and reading the syntax tree, record the characteristics of the generated executable high-level language code, and generate a corresponding high-level language code characteristic description file;

检测所述高级语言代码特性描述文件是否满足所述控制约束表,如果满足,则生成并输出相应的符合度报告,同时输出所述可执行高级语言代码文件和高级语言代码特性描述文件;否则进行相应的调整,并生成新的可执行高级语言代码文件。Detect whether the high-level language code feature description file satisfies the control constraint table, if so, generate and output a corresponding compliance report, and output the executable high-level language code file and high-level language code feature description file; otherwise, proceed Adjust accordingly, and generate a new executable high-level language code file.

更进一步地,所述语法树构建方法包括:Further, the syntax tree construction method includes:

根据所述控制约束表和语法配置表,以语法或者词法元素的类标识或者实例为结点,随机生成相应的基本子树集;According to the control constraint table and the syntax configuration table, using the class identifier or instance of the syntax or lexical element as a node, randomly generate a corresponding basic subtree set;

根据所述控制约束表和语法配置表,随机将各子树进行合并,生成新的子树集,合并的条件为将要合并的两棵子树中的一棵子树的根结点与另一棵子树的叶结点类型相同;According to the control constraint table and the grammar configuration table, each subtree is randomly merged to generate a new subtree set. The leaf node types of are the same;

将结点最多的子树作为主树,其它子树作为附树,根据所述控制约束表和语法配置表,按照自底向上延展的方向,随机对所述主树和附树进行多轮合并,生成相应总语法树。The subtree with the most nodes is used as the main tree, and the other subtrees are used as the attached trees. According to the control constraint table and the grammar configuration table, according to the direction of extending from bottom to top, randomly perform multiple rounds of merging of the main tree and the attached trees , to generate the corresponding total syntax tree.

本发明的有益效果是:The beneficial effects of the present invention are:

本发明的高级语言代码生成器,通过语法配置模块将输入的语法支持情况描述信息转换为相应的语法配置表;再通过控制参数提取模块将输入的验证或者测试策略转换为相应的控制约束表;再由语法树生成模块根据该语法配置表和控制约束表,调用高级语言语法库中的语法和词法元素,构建对应的语法树,再由代码生成模块将生成的语法树转换为对应的可执行代码,同时生成可执行代码特性描述文件。由于语法树生成模块构建的语法树,能够满足控制约束条件,能够保证代码的可行性。本发明的高级语言代码生成器生成的高级语言代码,有良好的相关性和随机性,保证了代码的精简性,使得能够更自然地模拟实际算法代码,从而为保证EDA设计工具对各种代码描述的转换的正确性提供了优质的测试用例,从而减轻了人工编写测试代码的压力。另一方面,由于高级语言语法库可以根据不同EDA工具支持语言的不同进行修改,以支持其他语言形式,从而提高了代码产生器的可扩展性。The high-level language code generator of the present invention converts the input syntax support description information into a corresponding syntax configuration table through the syntax configuration module; then converts the input verification or test strategy into a corresponding control constraint table through the control parameter extraction module; Then, the grammar tree generation module calls the grammar and lexical elements in the high-level language grammar library according to the grammar configuration table and the control constraint table to construct a corresponding grammar tree, and then the code generation module converts the generated grammar tree into a corresponding executable code, and generate an executable code feature description file at the same time. Because the syntax tree constructed by the syntax tree generation module can satisfy the control constraints and ensure the feasibility of the code. The high-level language code that the high-level language code generator of the present invention generates has good correlation and randomness, has guaranteed the simplification of code, makes can simulate actual algorithm code more naturally, thereby guarantees that EDA design tool is to various codes The correctness of the described transformations provides high-quality test cases, which relieves the pressure of manually writing test codes. On the other hand, because the high-level language syntax library can be modified according to the language supported by different EDA tools to support other language forms, thereby improving the scalability of the code generator.

同时本发明的高级语言代码生成器还生成相应的高级语言代码特性描述文件,用户可直接通过该高级语言代码特性描述文件了解产生的可执行高级语言代码的特性,从而便于检查自己的验证或测试策略是否与产生的代码对应,即将验证或测试人员的关注点从测试代码的编写转移到验证或测试的策略上来,并为以高级语言为起点的转换或综合工具提供测试或验证时所需要的符合各自设计特点的全面的测试用例,同时可以根据该可执行文件的特性描述指导验证或测试策略的实施,进而进一步减轻了人工编写代码的压力。本发明的高级语言代码生成器还可通过符合度检测模块来检测产生的高级语言代码是否符合需要,当产生的高级语言代码有问题时,再由该符合度检测模块在允许迭代次数内,自动调整内部设置,重新产生新的高级语言代码,并且该迭代次数上限可设置,即是说本发明的高级语言生成器通过设置了符合度检测模块,从而使得该高级语言代码产生器能够进行自检。Simultaneously, the high-level language code generator of the present invention also generates corresponding high-level language code characteristic description files, and users can directly understand the characteristics of the executable high-level language codes generated through the high-level language code characteristic description files, thereby facilitating checking of their own verification or testing Whether the strategy corresponds to the generated code, that is, to shift the focus of the verification or tester from the writing of the test code to the verification or testing strategy, and to provide the conversion or synthesis tools starting from the high-level language. What is needed for testing or verification Comprehensive test cases conforming to their respective design characteristics can guide the implementation of verification or test strategies according to the description of the characteristics of the executable file, thereby further reducing the pressure of manual code writing. The high-level language code generator of the present invention can also detect whether the generated high-level language code meets the requirements through the compliance degree detection module. Adjust the internal settings to regenerate new high-level language codes, and the upper limit of the number of iterations can be set, that is to say, the high-level language generator of the present invention is provided with a compliance detection module, so that the high-level language code generator can perform self-test .

本发明的高级语言代码生成方法,通过将输入的语法支持情况描述信息和验证或者测试策略的策略级描述信息,分别转换为相应的语法配置表和控制约束表,再根据该语法配置表和控制约束表,调用语法库内的语法和词法元素,并通过语法树构建方法构建相应的语法树,再通过遍历读取该语法树生成相应的可执行高级语言代码和高级语言代码特性描述文件,从而将验证或测试人员的关注点从测试代码的编写转移到验证或测试的策略上来,避免了使用现成的算法代码时,语法现象不全,测点不明确,调试定位不方便的问题;同时,由于所构建的语法树,均满足控制约束表,使得由该语法树转换得到的高级语言代码,有良好的相关性和随机性,并且生成的高级语言代码精简,减少了无关代码,从而使得能够更自然地模拟实际算法代码,保证了产生的高级语言代码测试用例的直接可执行性,进而减轻了人工编写代码的压力。The high-level language code generation method of the present invention converts the input syntax support description information and the strategy-level description information of the verification or test strategy into corresponding syntax configuration tables and control constraint tables respectively, and then according to the syntax configuration table and control The constraint table calls the grammar and lexical elements in the grammar library, constructs the corresponding grammar tree through the grammar tree construction method, and then generates the corresponding executable high-level language code and high-level language code feature description file by traversing and reading the grammar tree, so that Shift the focus of verification or testers from writing test codes to verification or testing strategies, avoiding the problems of incomplete grammar, unclear measurement points, and inconvenient debugging and positioning when using ready-made algorithm codes; at the same time, due to The constructed syntax trees all satisfy the control constraint table, so that the high-level language codes converted from the syntax trees have good correlation and randomness, and the generated high-level language codes are simplified, reducing irrelevant codes, so that more Naturally simulating the actual algorithm code ensures the direct executable of the generated high-level language code test cases, thereby reducing the pressure of manual code writing.

另一方面,本发明的高级语言代码生成方法中,语法树的构建方法通过随机将子树合并为主树的方式,再随机将主树和附树按照向上延展的方向来合并,生成总语法树。由于每棵子树都满足控制约束条件,使得在子树合并成主树的过程中可控性增加;并且由子树集合并到总语法树的过程中,子树的总数目逐渐减少,最终收敛为一棵树,从而使得可以在尽量少的代码量下达到相应要求,且在满足控制约束条件的前提下尽快收敛,进而提高了由该语法树转换得到的代码的相关性和随机性,使得能够更自然地模拟实际算法代码。On the other hand, in the high-level language code generation method of the present invention, the construction method of the syntax tree is by randomly merging the subtrees into the main tree, and then randomly merging the main tree and the auxiliary tree in the direction of upward extension to generate the total grammar Tree. Since each subtree satisfies the control constraints, the controllability increases in the process of merging subtrees into the main tree; and in the process of merging the subtree set into the total syntax tree, the total number of subtrees gradually decreases, and the final convergence is A tree, so that the corresponding requirements can be met with as little code as possible, and it can converge as soon as possible under the premise of satisfying the control constraints, thereby improving the relevance and randomness of the code converted from the syntax tree, making it possible to More natural simulation of actual algorithmic code.

附图说明 Description of drawings

图1为本发明的高级语言代码生成器的一实施例的结构示意图;Fig. 1 is the structural representation of an embodiment of the high-level language code generator of the present invention;

图2为本发明的代码生成模块的一实施例的结构示意图;Fig. 2 is a schematic structural diagram of an embodiment of the code generation module of the present invention;

图3为本发明的高级语言代码生成方法的一实施例的流程图;Fig. 3 is the flowchart of an embodiment of the high-level language code generation method of the present invention;

图4a、图4b和图4c分别为本发明的高级语言代码生成方法的一实施例中语法配置表的语法点支持信息、实现形式约束信息和特殊语法现象约束信息的示意图;Fig. 4a, Fig. 4b and Fig. 4c are schematic diagrams of grammar point support information, implementation form constraint information and special grammar phenomenon constraint information of the grammar configuration table in an embodiment of the high-level language code generation method of the present invention;

图5a和图5b分别为本发明的高级语言代码生成方法的一实施例中变量使用信息和程序流程布局的示意图;FIG. 5a and FIG. 5b are schematic diagrams of variable usage information and program flow layout in an embodiment of the high-level language code generation method of the present invention;

图6为本发明的语法树构建方法的一实施例的流程图;Fig. 6 is the flowchart of an embodiment of the syntax tree construction method of the present invention;

图7a、图7b和图7c分别为本发明的语法树构建方法的一实施例中生成子树集的示意图,合并子树集生成新的子树集的示意图,以及生成总语法树的示意图。Fig. 7a, Fig. 7b and Fig. 7c are respectively a schematic diagram of generating a subtree set in an embodiment of the syntax tree construction method of the present invention, a schematic diagram of merging subtree sets to generate a new subtree set, and a schematic diagram of generating a total syntax tree.

具体实施方式 Detailed ways

下面通过具体实施方式结合附图对本发明作进一步详细说明。The present invention will be further described in detail below through specific embodiments in conjunction with the accompanying drawings.

请参考图1,为本实施方式的高级语言代码产生器的一实施例的结构示意图。本实施方式的高级语言代码产生器,包括:语法配置模块1,用于接收输入的EDA设计工具的语法支持情况描述信息,并将该语法支持情况描述信息转换为相应的语法配置表;控制参数提取模块2,用于接收输入的验证或者测试策略的策略级描述信息,并将该验证或者测试策略的策略级描述信息转化为相应的控制约束表;高级语言语法库3,用于将需要的高级语言的所有语法和词法元素描述进行分类存储;语法树生成模块4,与语法配置模块1、高级语言语法库3和控制参数提取模块2相连,用于根据语法配置模块1生成的语法配置表,以及参数提取模块2生成的控制约束表,调用高级语言语法库中的语法和词法元素,以生成相应的语法树;代码生成模块5,与语法树生成模块4相连,用于遍历读取该语法树生成模块4生成的语法树,生成相应的可执行高级语言代码文件。Please refer to FIG. 1 , which is a schematic structural diagram of an embodiment of the high-level language code generator of this embodiment. The high-level language code generator of the present embodiment comprises: grammar configuration module 1, is used to receive the grammar support situation description information of the EDA design tool of input, and this grammar support situation description information is converted into corresponding grammar configuration table; Control parameter The extraction module 2 is used to receive the strategy-level description information of the input verification or test strategy, and convert the strategy-level description information of the verification or test strategy into a corresponding control constraint table; the high-level language grammar library 3 is used to convert the required All grammatical and lexical element descriptions of the high-level language are classified and stored; the grammatical tree generation module 4 is connected with the grammatical configuration module 1, the high-level language grammatical library 3 and the control parameter extraction module 2, and is used for the grammatical configuration table generated by the grammatical configuration module 1 , and the control constraint table generated by the parameter extraction module 2, call the syntax and lexical elements in the high-level language grammar library to generate the corresponding syntax tree; the code generation module 5 is connected with the syntax tree generation module 4, and is used for traversing and reading the The syntax tree generated by the syntax tree generation module 4 generates a corresponding executable high-level language code file.

通常我们将高级语言语法标准中定义的允许出现的语法现象,称为标准语言。目前各种高级语言语法标准中,由于某些语法的支持难度较大,因此,EDA设计工具会选择支持某些语法点,而放弃支持另一些语法点,即支持一个小于标准语法集合的小集合,甚至还有在此基础上自定义的一些独特语法。本实施方式中的语法支持情况描述信息是指,EDA设计工具允许用户在编程时使用的语法,即该EDA设计工具可以支持的范围。Usually we refer to the allowable grammatical phenomena defined in the high-level language grammar standards as standard languages. In the current various high-level language grammar standards, because some grammars are difficult to support, EDA design tools will choose to support some grammar points, and give up supporting other grammar points, that is, support a small set that is smaller than the standard grammar set , and even some unique syntax customized on top of it. The syntax support description information in this embodiment refers to the syntax that the EDA design tool allows the user to use when programming, that is, the scope that the EDA design tool can support.

本实施方式中的策略级描述信息是相对于代码级而言的,即以较为抽象的形式对如何产生测试点的策略进行描述,例如伪代码,或者流程图等,而不是以代码的形式来描述。The policy-level description information in this embodiment is relative to the code level, that is, it describes how to generate the test point strategy in a more abstract form, such as pseudo-code, or flowchart, etc., rather than in the form of code describe.

本实施方式中,由语法配置模块1生成的语法配置表包括语法点支持信息、实现形式约束信息、特殊语法现象约束信息;由控制参数提取模块2生成的控制约束表包括:程序的流程布局信息、变量使用信息。In this embodiment, the syntax configuration table generated by the syntax configuration module 1 includes syntax point support information, implementation form constraint information, and special syntax phenomenon constraint information; the control constraint table generated by the control parameter extraction module 2 includes: program flow layout information , variable usage information.

本实施方式的高级语言代码生成器通过语法配置模块1将接收的输入的语法支持情况描述信息转换为相应的语法配置表,从而通过语法配置表中的语法配置、实行形式限制、特殊语法现象标注,实现语法约束的粗调、细调和微调;再通过控制参数提取模块2将输入的验证或者测试策略转换为相应的控制约束表,从而将测试或验证人员的思路转化成数字参数列表形式,形成友善的用户接口;再由语法树生成模块4根据该语法配置表和控制约束表,调用高级语言语法库中的语法和词法元素,构建对应的语法树,再由代码生成模块5将生成的语法树转换为对应的可执行代码,由于构建的语法树满足控制约束表,语法配置表,并符合相应高级语言语法和词法规则,从而由语法树转换得到的高级语言代码相关性提高,使得能够更自然地模拟实际算法代码,进而保证了生成的高级语言代码的可执行性,以降低人工编写代码的压力。The high-level language code generator of this embodiment converts the received input grammar support description information into a corresponding grammar configuration table through the grammar configuration module 1, thereby passing through the grammar configuration, implementation form restrictions, and special grammar phenomenon annotations in the grammar configuration table , to realize the coarse adjustment, fine adjustment and fine adjustment of grammatical constraints; and then convert the input verification or test strategy into the corresponding control constraint table through the control parameter extraction module 2, so as to convert the thinking of the tester or verification personnel into the form of a list of digital parameters, forming friendly user interface; then the grammar tree generation module 4 calls the grammar and lexical elements in the high-level language grammar library according to the grammar configuration table and the control constraint table to construct a corresponding grammar tree, and then the grammar generated by the code generation module 5 Tree is converted into corresponding executable code. Since the constructed syntax tree satisfies the control constraint table, syntax configuration table, and conforms to the corresponding high-level language grammar and lexical rules, the high-level language code obtained from the syntax tree conversion is more relevant, enabling more Naturally simulate the actual algorithm code, thereby ensuring the executable of the generated high-level language code, so as to reduce the pressure of manual coding.

另一方面,由于高级语言语法库可以根据不同EDA工具支持语言的不同进行修改,以支持其他语言形式,从而提高了高级语言代码产生器的可扩展性。On the other hand, since the high-level language grammar library can be modified according to the different languages supported by different EDA tools to support other language forms, the scalability of the high-level language code generator is improved.

本实施方式的高级语言代码产生器的代码生成模块5还用于在遍历语法树生成可执行高级语言代码时,记录生成的可执行高级语言代码的特性,从而生成相应高级语言代码特性描述文件。本实施方式的高级语言产生器还包括与代码生成模块5和控制参数提取模块2相连的符合度检测模块6,用于将代码生成模块5生成的高级语言代码特性描述文件,与控制参数提取模块2生成的控制约束表进行符合度核对,如果高级语言代码特性描述文件满足控制约束表,则生成相应的符合度报告,并输出符合度报告、可执行高级语言代码文件和高级语言代码特性描述文件;否则根据预先设置的允许的迭代次数,自动调整内部设置,重新生成新的可执行高级语言代码文件。The code generation module 5 of the high-level language code generator in this embodiment is also used to record the characteristics of the generated executable high-level language code when traversing the syntax tree to generate the executable high-level language code, so as to generate a corresponding high-level language code characteristic description file. The high-level language generator of the present embodiment also includes a conformity detection module 6 connected with the code generation module 5 and the control parameter extraction module 2, which is used to combine the high-level language code characteristic description file generated by the code generation module 5 with the control parameter extraction module 2 Check the compliance of the generated control constraint table, if the high-level language code characteristic description file meets the control constraint table, generate a corresponding compliance report, and output the compliance report, executable high-level language code file and high-level language code characteristic description file ; Otherwise, automatically adjust the internal settings according to the preset allowable number of iterations, and regenerate a new executable high-level language code file.

本实施方式的高级语言代码产生器,通过代码生成模块生成对应的高级语言特性描述文件,使得用户可以根据该高级语言特性描述文件,检测生成的高级语言代码是否符合需要。另一方面,通过将高级语言特性描述文件与由验证或者测试策略的策略级描述信息转化得到的控制约束表进行核对,来检测产生的代码是否符合需要,从而将验证或测试人员的关注点从测试代码的编写,转移到验证或测试的策略上来,并为以相应高级语言代码为起点的转换或综合工具提供测试或验证时所需要的符合各自设计特点的全面的测试用例,避免了使用现成的算法代码时,语法现象不全,测点不明确,调试定位不方便,进而减轻了编写代码的压力。同时,当产生的高级语言代码有问题时,可通过在符合度检测模块6在允许迭代次数内,自动调整内部设置,重新产生代码,并且该迭代次数上限可设置,即是说本实施方式的代码产生器可以通过该符合度检测模块6进行自检。The high-level language code generator in this embodiment generates a corresponding high-level language feature description file through the code generation module, so that the user can check whether the generated high-level language code meets requirements according to the high-level language feature description file. On the other hand, by checking the high-level language feature description file with the control constraint table converted from the strategy-level description information of the verification or test strategy, it is checked whether the generated code meets the requirements, thereby shifting the focus of the verification or tester from The writing of test code is transferred to the strategy of verification or testing, and provides comprehensive test cases that meet the respective design characteristics required for testing or verification for conversion or synthesis tools starting from the corresponding high-level language code, avoiding the use of off-the-shelf When using the algorithm code, the grammatical phenomenon is incomplete, the measurement points are not clear, and it is inconvenient to debug and locate, which in turn reduces the pressure of writing code. At the same time, when there is a problem with the generated high-level language code, the code can be regenerated by automatically adjusting the internal settings in the compliance detection module 6 within the allowable number of iterations, and the upper limit of the number of iterations can be set, that is to say, the upper limit of the number of iterations in this embodiment The code generator can perform self-test through the conformity detection module 6 .

请参考图2,为本实施方式的代码生成模块5的一实施例的结构示意图。本实施方式的代码生成模块5包括与语法树生成模块4相连的代码构建子模块51,以及与代码构建子模块51和符合度检测模块6相连的代码特性提取子模块52。其中,代码构建子模块51用于将语法树生成模块4构建好的语法树进行遍历读取,并生成可执行的高级语言代码文件;代码特性提取子模块52用于在代码构建子模块51遍历读取语法树的同时记录产生的可执行高级语言代码的特性,并产生相应的高级语言代码特性描述文件。Please refer to FIG. 2 , which is a schematic structural diagram of an embodiment of the code generation module 5 in this embodiment. The code generation module 5 of this embodiment includes a code construction submodule 51 connected to the syntax tree generation module 4 , and a code feature extraction submodule 52 connected to the code construction submodule 51 and the conformity detection module 6 . Wherein, the code construction submodule 51 is used for traversing and reading the syntax tree built by the syntax tree generation module 4, and generates an executable high-level language code file; the code feature extraction submodule 52 is used for traversing the While reading the syntax tree, record the characteristics of the generated executable high-level language code, and generate a corresponding high-level language code characteristic description file.

同时本实施方式中,当用户需要特定标注或者注释信息时,该代码构建子模块51提供在标准语言基础上增加其他信息量标注的接口,即可以输出用户需要的含特定标注或注释信息对应的代码。At the same time, in this embodiment, when the user needs specific annotation or annotation information, the code construction sub-module 51 provides an interface for adding other information volume annotations on the basis of the standard language, that is, it can output the specific annotation or annotation information corresponding to the user's needs. code.

由于某些EDA工具为了其各自的用途,而在某些语法标准之外,定义了该EDA工具自己可以识别的,用于特定用途的语法现象,因此,需要在产生代码的时候加入这些不通用的语法内容。Because some EDA tools define the grammatical phenomena that can be recognized by the EDA tool itself and are used for specific purposes outside of some grammatical standards for their respective purposes, therefore, it is necessary to add these non-common features when generating code grammatical content.

基于上述的高级语言代码生成器,本实施方式还提供一种高级语言代码生成方法,下面结合具体实施例和附图对本实施方式的高级语言代码生成方法进行详细的说明。Based on the above-mentioned high-level language code generator, this embodiment also provides a high-level language code generation method. The high-level language code generation method in this embodiment will be described in detail below with reference to specific embodiments and drawings.

请参考图3,为本实施方式的高级语言代码生成方法的一实施例的流程图。以C语言为例,本实施方式的高级语言代码生成方法包括:Please refer to FIG. 3 , which is a flow chart of an embodiment of the high-level language code generation method of this embodiment. Taking C language as an example, the high-level language code generation method of this embodiment includes:

S101,根据输入的EDA设计工具的语法支持情况描述信息,生成相应的语法配置表。S101. Generate a corresponding syntax configuration table according to the input syntax support description information of the EDA design tool.

本实施方式中,生成的语法配置表包括:语法点支持信息、实现形式约束信息、特殊语法现象约束信息等,且语法配置表会对一些信息设定默认约束值。In this embodiment, the generated grammar configuration table includes: grammar point support information, implementation form constraint information, special grammar phenomenon constraint information, etc., and the grammar configuration table will set default constraint values for some information.

本实施方式中,通过将语法支持情况描述信息转换为相应的语法配置表,从而通过语法配置、实行形式限制、特殊语法现象标注的机制实现语法约束的粗调、细调和微调。In this embodiment, by converting the grammar support description information into a corresponding grammar configuration table, the coarse adjustment, fine adjustment and fine adjustment of grammar constraints are realized through the mechanism of grammar configuration, implementation form restriction, and special grammar phenomenon marking.

请参考图4a、图4b和图4c,分别为本实施方式中语法配置表中语法点支持信息、实现形式约束信息和特殊语法现象约束信息的示意图。其中,语法点支持信息包括了对数据类型、运算符类型等语法点的支持情况,即在语法配置表的语法点支持信息表格上,将相应的选项打钩(或Y/N)即可;实现形式约束信息包括:循环嵌套次数、条件嵌套次数等信息的约束情况,在已有的实现形式约束信息表格上完成限制的输入即可;特殊语法现象约束信息指在有较特殊的语法限制条件下填写,并且在系统提供的特殊语法现象描述规则的基础上填写,表述严谨。Please refer to FIG. 4a, FIG. 4b and FIG. 4c, which are schematic diagrams of grammar point support information, implementation form constraint information, and special grammar phenomenon constraint information in the grammar configuration table in this embodiment, respectively. Among them, the grammar point support information includes the support of grammar points such as data types and operator types, that is, on the grammar point support information form of the grammar configuration table, check the corresponding option (or Y/N); realize Formal constraint information includes: the constraints of information such as loop nesting times and conditional nesting times, which can only be entered on the existing implementation form constraint information form; special grammatical phenomenon constraint information refers to the situation where there are more special grammatical constraints Fill in under the conditions, and fill in on the basis of the special grammatical phenomenon description rules provided by the system, and the expression is rigorous.

请参考图4c,本实施方式的一实施例中,特殊语法现象约束信息中第一条表示“如果出现双目运算符构成的表达式,则双目运算符左右两边的数据类型不能同时为常数,并且必须数据类型一致”;第二条表示“如果出现双目运算符构成的表达式,则当双目运算符是移位运算时,移位运算的第二个操作数的数据类型要为立即数”;第三条表示“如果出现声明语句,则当声明语句使用逗号完成连续声明时,不允许出现一些初始化一些不初始化的现象”。Please refer to Figure 4c. In an example of this embodiment, the first item in the special syntax phenomenon constraint information indicates "If an expression composed of a binocular operator appears, the data types on the left and right sides of the binocular operator cannot be constants at the same time. , and the data types must be the same”; the second clause means “if there is an expression composed of a binary operator, when the binary operator is a shift operation, the data type of the second operand of the shift operation must be Immediate value"; the third item means "if there is a declaration statement, when the declaration statement uses a comma to complete the continuous declaration, some initialization and some non-initialization phenomena are not allowed."

S103,根据输入的验证或者测试策略的策略级描述信息,生成相应的控制约束表。S103. Generate a corresponding control constraint table according to the input strategy-level description information of the verification or test strategy.

本实施方式中的策略级描述信息是相对于代码级而言的,即以较为抽象的形式对如何产生测试点的策略进行描述,例如伪代码,或者流程图等,而不是以代码的形式来描述。The policy-level description information in this embodiment is relative to the code level, that is, it describes how to generate the test point strategy in a more abstract form, such as pseudo-code, or flowchart, etc., rather than in the form of code describe.

本实施方式通过将验证或者测试策略的策略级描述信息转换为相应的控制约束表,将测试或验证人员的思路转化成数字参数列表形式,形成了友善的用户接口,便于工程师之间的交流。This embodiment transforms the strategy-level description information of the verification or test strategy into the corresponding control constraint table, and transforms the thinking of the tester or verification personnel into a list of digital parameters, forming a friendly user interface and facilitating communication between engineers.

本实施方式中,生成的控制约束表包括:程序的流程布局信息、变量使用信息等。请参考图5a,为本实施方式的一实施例中变量使用信息的示意图,由于产生代码时可以以函数为单位,该变量使用信息可以包括:在构造函数时对函数内变量总数的数量限制,优先使用变量的变量名、变量类型、变量初值、作用域等信息。In this embodiment, the generated control constraint table includes: program flow layout information, variable usage information, and the like. Please refer to FIG. 5a, which is a schematic diagram of variable usage information in an example of this embodiment. Since the code can be generated in units of functions, the variable usage information can include: when constructing a function, limit the number of variables in the function, Information such as the variable name, variable type, variable initial value, and scope of the variable is used preferentially.

请参考图5b,为本实施方式的一实施例中程序的流程布局信息示意图,该程序的流程布局信息可以包括各语法点的位置安排,例如其中while语句中插入if语句;各语法点属性的设置,例如其中对赋值语句assignStatement出现的数量属性amount进行设置;以及插入指定代码,例如其中“i_count+=i_refa;”为插入指定代码等。Please refer to Figure 5b, which is a schematic diagram of the flow layout information of the program in an example of this embodiment, the flow layout information of the program may include the position arrangement of each grammar point, for example, if statement is inserted in the while statement; the attributes of each grammar point Setting, for example, setting the quantity attribute amount appearing in the assignment statement assignStatement; and inserting a specified code, for example, where "i_count+=i_refa;" is inserting a specified code, etc.

S105,根据生成的语法配置表和控制约束表,调用相应语法库内的语法和词法元素,并通过语法树构建方法构建相应的语法树。S105. According to the generated syntax configuration table and control constraint table, call the syntax and lexical elements in the corresponding syntax library, and construct the corresponding syntax tree through the syntax tree construction method.

请参考图6,本实施方式的语法树构建方法包括:Please refer to Fig. 6, the syntax tree construction method of the present embodiment comprises:

S1051,根据控制约束表和语法配置表,以语法或者词法元素的类标识或者实例为结点,随机生相应的基本成子树集。S1051. According to the control constraint table and the syntax configuration table, randomly generate a corresponding set of basic subtrees with class identifiers or instances of syntax or lexical elements as nodes.

本实施方式中,为了保证语法树中必须存在用户选择的语法点,首先读入用户需求,以用户选择的基本语法点为主要框架,向上或者向下延展,使得产生包含该基本语法点的子树的可合并结点增多,提高生成的各子树之间的可合并性,从而使得由该子树构成的基本子树集的各子树更容易完成到语法树的合并。In this embodiment, in order to ensure that there must be a grammar point selected by the user in the syntax tree, the user's needs are first read, and the basic grammar point selected by the user is used as the main framework to extend upward or downward, so that a subclass containing the basic grammar point is generated. The number of mergeable nodes of the tree increases, and the mergeability among the generated subtrees is improved, so that it is easier to complete the merger of each subtree of the basic subtree set formed by the subtree into the syntax tree.

请参考图7a,本实施方式的一实施例中,需要产生的代码中包括两个if结构和两个for结构,则根据控制约束表和语法配置表生成四个独立的结点:ifstat,ifstat,forstat,forstat。然而这四个独立的结点不能直接进行合并,因此,我们先对这四个结点进行向上或向下延展,使得由这四个独立结点延展出的树的可合并结点增多,提高各树之间的可结合性,从而更容易完成到语法总树的合并。由于C语言产生式中,所有的ifstat和forstat都必须由stat推出,即所有的ifstat和forstat的父结点都必须是结点stat,而且结点stat在C语言产生式中出现的概率更高,即在合并时的可结合率更高,所以这里的四个结点都向上延展一步,从而得到两棵包含if结构的子树101和子树102,以及两棵包含for结构的子树103和子树104,即得到相应的基本子树集。Please refer to Fig. 7a, in an example of this embodiment, the code to be generated includes two if structures and two for structures, then four independent nodes are generated according to the control constraint table and the grammar configuration table: ifstat, ifstat , forstat, forstat. However, these four independent nodes cannot be merged directly. Therefore, we first extend these four nodes upwards or downwards, so that the number of mergeable nodes of the tree extended by these four independent nodes increases, improving The associability between each tree makes it easier to complete the merge into the total syntax tree. Because in the C language production, all ifstat and forstat must be derived from stat, that is, the parent node of all ifstat and forstat must be the node stat, and the node stat has a higher probability of appearing in the C language production , that is, the combinability rate is higher when merging, so the four nodes here are all extended one step upwards, so as to obtain two subtrees 101 and 102 containing if structures, and two subtrees 103 and subtrees containing for structures. tree 104, that is, to obtain the corresponding basic subtree set.

本实施方式中,一棵语法树只有一个根结点,但是可以有很多个叶结点,且在构建语法树或者总语法树时,对需要确定结点类型或者结点内容的结点,并且该结点的内容或者类型在经过语法配置约束后的规则上又是可选的情况下,再根据随机函数,在可选范围内进行随机选择。In this embodiment, a grammatical tree has only one root node, but there may be many leaf nodes, and when constructing a grammatical tree or a total grammatical tree, it is necessary to determine the node type or node content, and If the content or type of the node is optional in the rules constrained by the grammar configuration, it is randomly selected within the optional range according to the random function.

本实施方式中,随机函数是指在指定范围内产生一个随机的数,由该随机数来决定C语言产生式的可能产生的子树的棵数,高级语言通常都会提供随机函数。例如,C语言产生式里有block->statn,即block可以推出n个stat(n≥0),而这个n的具体数值,则由随机函数产生的一个随机数来确定。In this embodiment, the random function refers to generating a random number within a specified range, and the random number determines the number of subtrees that may be generated by the C language production. High-level languages usually provide random functions. For example, there is block->stat n in the C language production, that is, the block can generate n stats (n≥0), and the specific value of this n is determined by a random number generated by the random function.

本实施方式中的随机函数是可以被多次调用,而每次根据不同的需要,调用的随机函数产生的随机数都不重复使用,即每次产生的随机数都不同,但随机函数每次被调用时,都会有一个最大值,这个最大值限制了随机数的产生范围。例如最大值是7,那么随机函数产生的随机值就只能是0到6中的任一个。The random function in this embodiment can be called multiple times, and each time according to different needs, the random numbers generated by the called random function are not reused, that is, the random numbers generated each time are different, but the random function generates a random number every time. When called, there will be a maximum value, which limits the range of random number generation. For example, the maximum value is 7, then the random value generated by the random function can only be any one of 0 to 6.

S1053,根据控制约束表和语法配置表,随机将子树进行多轮合并,生成新的子树集,其中,合并的条件为将要合并的两棵子树中的一棵子树的根结点与另一棵子树的叶结点类型相同。S1053. According to the control constraint table and the grammar configuration table, randomly merge the subtrees for multiple rounds to generate a new subtree set, wherein the merge condition is that the root node of one of the two subtrees to be merged is the same as the root node of the other. The leaf nodes of a subtree are of the same type.

本实施方式中,对在每一步向上延伸的过程中,新的根结点可根据产生式要求随机确定,且延伸过程中,获得的非叶结点,即非终结符,以新的结点作为搜索条件搜索能够进行合并的子树。In this embodiment, during each step of upward extension, the new root node can be randomly determined according to the requirements of the production formula, and during the extension process, the obtained non-leaf nodes, that is, non-terminal symbols, are replaced by new node A subtree that can be merged is searched for as a search condition.

请参考图7b,随机将图7a中的各子树进行合并,生成新的子树集包括:首先,由于可推出stat的产生式集为{block->statn,ifStat->if(expr)stat,......},则通过随机函数获得第二个产生式ifStat->if(expr)stat,即子树101的叶结点ifstat可推出if(expr)stat,由于推出后的该叶结点stat与子树103的根结点stat类型相同,因此合并子树101和103获得子树201,第一轮合并结束。Please refer to Figure 7b, randomly merge the subtrees in Figure 7a, and generate a new subtree set includes: First, since the production set of stat can be deduced as {block->stat n , ifStat->if(expr) stat, ...}, then the second production ifStat->if(expr)stat is obtained through a random function, that is, the leaf node ifstat of the subtree 101 can deduce if(expr)stat, because the deduced The leaf node stat is of the same type as the root node stat of subtree 103, so subtree 201 is obtained by merging subtrees 101 and 103, and the first round of merging ends.

当然,本实施例中的子树101,子树102,子树103和子树104都可以相互合并。但进行具体合并操作时,会统计各个子树间的合并可能性,并根据合并的可能性,由随机函数来产生的一个随机数来确定具体将哪两棵子树进行合并。例如子树间可合并的方案有M个,那么随机函数输入值就是M,若输出为N则0=<N<M,得出的数值表示调用第N个方案。例如本实施例中当随机函数产生的值为0时,则将子树101和子树102合并;当随机函数产生的值为1时,则将子树101和子树103合并。Certainly, the subtree 101, the subtree 102, the subtree 103 and the subtree 104 in this embodiment can all be merged with each other. However, when performing a specific merging operation, the merging possibility between each subtree will be counted, and according to the merging possibility, a random number generated by a random function will determine which two subtrees will be merged. For example, there are M schemes that can be merged between subtrees, then the input value of the random function is M, if the output is N, then 0=<N<M, and the obtained value indicates that the Nth scheme is called. For example, in this embodiment, when the value generated by the random function is 0, the subtree 101 and the subtree 102 are merged; when the value generated by the random function is 1, the subtree 101 and the subtree 103 are merged.

本实施方式中,expr(表达式)和不含嵌套的stat(一般语句)等简单结构可以以自顶向下的形式随机生成。为了协助更快地生成随机附树,在子树集中需要产生足够的expr(表达式)和stat(一般语句)。In this embodiment, simple structures such as expr (expression) and stat (general statement) without nesting can be randomly generated in a top-down manner. In order to assist in generating random attached trees more quickly, sufficient expr (expression) and stat (general statement) need to be generated in the set of subtrees.

本实施方式中,当存在某种语法的嵌套时,所允许的嵌套层数如果用户没有指定,则在建树前需要对其进行确定,可随机确定或者默认设置。例如在程序开始的时候,由随机函数获得随机数3(这个数字可以由用户直接设定,或者取一个默认值),则确定嵌套层数为3,即不允许stat向下的各条路径中任何一条路径上出现3个以上的stat;如果在程序开始,获得随机数0,则在stat往后推导的过程中,就不能再出现stat,且任何一条由根结点到叶结点的完整路径,某种语法的嵌套层数都可以通过统计该路径上出现的相同的该语法类型结点的数目来计算。In this embodiment, when there is some kind of grammatical nesting, if the user does not specify the allowable nesting level, it needs to be determined before building the tree, which can be determined randomly or set by default. For example, at the beginning of the program, the random number 3 is obtained by the random function (this number can be set directly by the user, or take a default value), then the number of nesting layers is determined to be 3, that is, each path downward of stat is not allowed There are more than 3 stats on any one of the paths; if a random number 0 is obtained at the beginning of the program, then in the process of stat derivation, no stat can appear again, and any path from the root node to the leaf node The complete path and the nesting level of a certain grammar can be calculated by counting the number of nodes of the same grammar type appearing on the path.

其次,这里可以选择block或者forstat等作为该子树201的新的根结点,本实施例中选择由block作为新的根结点,则运行随机函数获得产生式block->statstat,且由该产生式推出的两个stat中的新的stat为非终结符,则以该非终结符stat为新的结点搜索能够进行合并的附树,则搜索到根结点为stat的子树104和子树102,再根据随机函数产生的随机数决定将子树201与子树104合并,从而合并子树201和子树104,获得子树202,第二轮合并结束。Secondly, block or forstat can be selected here as the new root node of the subtree 201. In this embodiment, block is selected as the new root node, then a random function is run to obtain the production block->statstat, and the The new stat in the two stats introduced by the production is a non-terminal symbol, then use the non-terminal symbol stat as a new node to search for an attached tree that can be merged, and then search for the subtree 104 and the subtree whose root node is stat. Tree 102, and then decides to merge subtree 201 and subtree 104 according to the random number generated by the random function, thereby merging subtree 201 and subtree 104 to obtain subtree 202, and the second round of merging ends.

本实施例中,子树201可与子树102或者子树104进行合并,但由随机函数确定该子树201与子树102合并或者与子树104进行合并。In this embodiment, the subtree 201 can be merged with the subtree 102 or the subtree 104, but it is determined by a random function that the subtree 201 is merged with the subtree 102 or with the subtree 104.

最后,由于子树102的根结点/叶结点,不能在子树202中寻找到相应可合并的叶结点/根结点,因此,不能够进行合并,得到新的子树集:子树202和子树102。Finally, due to the root node/leaf node of the subtree 102, the corresponding mergeable leaf node/root node cannot be found in the subtree 202, therefore, cannot be merged to obtain a new subtree set: Tree 202 and subtree 102.

S1055,将结点最多的子树作为主树,其它子树作为附树,对主树进行自底向上延展,随机地进行多轮合并,生成相应的总语法树。S1055, taking the subtree with the most nodes as the main tree, and other subtrees as auxiliary trees, extending the main tree from bottom to top, randomly performing multiple rounds of merging, and generating a corresponding total syntax tree.

请参考图7c,为本实施方式的将主树和附树进行合并,生成总语法树的一实施例的示意图。本实施方式的一具体实施例中,将主树和附树进行合并,生成总语法树包括:根据上述的合并结果,选择结点数较多的子树202作为主树,子树102作为附树进行新一轮合并:令主树202向上延伸,通过随机函数获得产生式stat->block,则主树202的根结点变成stat;然后,通过随机函数获得产生式ifStat->if(expr)stat,即由子树102中的if Stat推出if(expr)stat;由于该子树102推出后的该叶结点stat与主树202的根结点stat类型相同,则将主树202和子树102合并,则所有子树合并完毕。Please refer to FIG. 7 c , which is a schematic diagram of an example of merging the main tree and the subsidiary tree to generate a total syntax tree according to this embodiment. In a specific example of this embodiment, merging the main tree and the attached tree to generate the total syntax tree includes: according to the above-mentioned merging result, selecting the subtree 202 with more nodes as the main tree, and the subtree 102 as the attached tree Carry out a new round of merging: extend the main tree 202 upwards, obtain the production formula stat->block through the random function, then the root node of the main tree 202 becomes stat; then, obtain the production formula ifStat->if(expr )stat, that is, the if Stat in the subtree 102 is released if (expr)stat; since the leaf node stat after the subtree 102 is released is the same as the root node stat type of the main tree 202, then the main tree 202 and the subtree 102 merge, then all subtrees are merged.

请参考图7c,附树与主树合并后得到子树301,该子树中的结点expr为非终结符,由于附树中不存在以expr为根结点的子树,所以将随机产生一棵以结点expr为根结点的附树,然后再将这棵附树合并到主树301的结点expr中;同时由于子树301的根结点已经是树的顶点了,所以结点expr就需要不断向下延展,将其自身补全。Please refer to Figure 7c, the subtree 301 is obtained after the subtree is merged with the main tree, and the node expr in the subtree is a non-terminal symbol. Since there is no subtree with expr as the root node in the subtree, it will be randomly generated An attached tree with the node expr as the root node, and then merge this attached tree into the node expr of the main tree 301; at the same time, since the root node of the subtree 301 is already the vertex of the tree, the resulting Click expr to continue to extend downwards to complete itself.

本实施方式中的终结符为语言里最基本的元素,即不能够进一步分解,如图7c中,由于ifstat可以推出if(expr)stat,因此,其不为终结符;而由ifstat推出的if(expr)stat中,由于“if”、“(”和“)”不能够再推出别的元素,即为终结符。The terminator in the present embodiment is the most basic element in the language, promptly can not be further decomposed, as in Fig. 7 c, because ifstat can release if (expr) stat, therefore, it is not a terminator; And the if released by ifstat In (expr)stat, because "if", "(" and ")" cannot deduce other elements, they are terminators.

本实施方式中,当只有一棵主树时,选择最短路径到达function根结点。在本实施例中,由于只有一棵主树202,则在该主树202向上延伸的过程中,不再选用随机产生式,而是向前探测最短到达function的路径,最后通过产生式block->stat,function->type ID(formalParameter)block获得子树301,至此,以funtion为根结点的子树,即语法树构建完毕。In this embodiment, when there is only one main tree, the shortest path is selected to reach the function root node. In this embodiment, since there is only one main tree 202, in the process of extending the main tree 202 upwards, the random production is no longer selected, but the shortest path to function is detected forward, and finally through the production block- >stat, function->type ID (formalParameter) block obtains subtree 301, so far, the subtree with function as the root node, that is, the syntax tree is constructed.

本实施例中一棵语法树只代表一个函数,在完整代码的产生过程中,生成的语法树总棵数由函数个数来决定。In this embodiment, one syntax tree represents only one function, and the total number of generated syntax trees is determined by the number of functions during the complete code generation process.

当然当附树不仅仅只有子树102一棵时,则在将附树102与主树202合并后,再将其余的附树随机进行多轮合并,且以自底向上延展的主要方式,最终得到总的语法树。Of course, when there is not only one subtree 102 in the attached tree, after merging the attached tree 102 with the main tree 202, the rest of the attached trees are randomly merged for multiple rounds, and in the main way of extending from bottom to top, finally Get the total syntax tree.

本实施方式中,每一次对主树进行向上延展的过程中,新的根结点可根据产生式要求随机确定,且在延伸过程中,获得非叶结点,即非终结符,则以该新的非终结符作为搜索条件搜索能够进行合并的附树,如果符合条件的附树不存在,则可以随机产生符合条件的附树进行合并。In this embodiment, each time the main tree is extended upwards, the new root node can be randomly determined according to the requirements of the production formula, and during the extension process, if a non-leaf node, that is, a non-terminal symbol, is obtained, then the The new non-terminal symbol is used as the search condition to search for the attached trees that can be merged. If the attached trees that meet the conditions do not exist, then the eligible attached trees can be randomly generated for merging.

本实施方式中,随机对各子树进行多轮合并,并向上延展生成总语法树过程中,必须以满足控制约束表上的条款为目的,以语法配置表为限制,符合C语言语法和词法规则,运用合理的带约束的随机机制,以自底向上延展为主要方式,生成符合用户需求的语法树,且主树每一次向上延展之前,都必须保证所有的叶结点都是终结符,否则以该非终结符为搜索条件搜索能够合并的附树进行合并或者随机产生符合条件的附树进行合并,即结合不含嵌套的向下补全方式来产生符合要求的语法树。In this embodiment, multiple rounds of merging are randomly performed on each subtree, and in the process of extending upward to generate the total syntax tree, the purpose of satisfying the terms on the control constraint table must be met, limited by the syntax configuration table, and conform to the C language grammar and vocabulary Rules, use a reasonable random mechanism with constraints, and use bottom-up extension as the main method to generate a syntax tree that meets user needs, and each time the main tree is extended upwards, it must be guaranteed that all leaf nodes are terminal symbols. Otherwise, use the non-terminal symbol as the search condition to search for merging attached trees for merging, or randomly generate eligible attached trees for merging, that is, combine the downward completion method without nesting to generate a syntax tree that meets the requirements.

本实施方式中采用向上延展,向下补全缺少结点的方式来构建语法树,可以很好地控制嵌套次数等约束条件的实施,同时,对主树采用自底向上延展的方式,以产生更多需要补全的结点,这样才能根据附树的根结点的情况,将附树合并到主树上,最后收敛为一棵总语法树,并且由于合并时,必须满足附树的根结点与主树上需要补全的叶结点的类型相同,因此,只有作为终结符的结点作为叶结点时,才不需要继续补全。如果不能够使用现有的附树将主树补全,则根据随机函数产生需要的相应子树来补全。In this embodiment, the syntax tree is constructed by extending upwards and filling in missing nodes downwards, which can well control the implementation of constraints such as the number of nesting times. At the same time, the main tree is extended from the bottom up to Generate more nodes that need to be completed, so that the attached tree can be merged into the main tree according to the condition of the root node of the attached tree, and finally converge into a total syntax tree, and because the merger must meet the requirements of the attached tree The root node is of the same type as the leaf node that needs to be completed on the main tree, so only when the node that is a terminal symbol is a leaf node, it does not need to continue to complete. If the existing attached tree cannot be used to complete the main tree, a corresponding subtree is generated according to the random function to complete it.

当然,本实施方式中的将主树与附树进行多轮合并时,也可以按照向下延展的方向,但最后都需要将缺少的结点补充完整,才能构成完整的语法树。Of course, in this embodiment, when merging the main tree and the subsidiary tree for multiple rounds, it can also follow the direction of downward extension, but in the end, the missing nodes need to be completed to form a complete syntax tree.

本实施方式中,构建语语法树过程中,当C语言产生式可能产生的相同子树的棵数不确定时,子树的棵数由随机函数决定,随机数的最大值由当前附树的棵数决定;另外,如果if,while等主要语句出现的最大次数用户没有指定,则在建语法树前对其进行确定,可随机确定或者默认设置。In this embodiment, in the process of constructing the grammar tree, when the number of the same subtrees that may be generated by the C language production is uncertain, the number of subtrees is determined by a random function, and the maximum value of the random number is determined by the current attached tree. The number of trees is determined; in addition, if the user does not specify the maximum number of occurrences of main statements such as if and while, it will be determined before building the syntax tree, which can be determined randomly or set by default.

本实施方式通过由子树组建主树,并最终合并为总语法树的过程中,由于每一棵子树都必须满足控制约束表,从而使得由子树组建语法树的过程中可控性增加,且快速收敛为总语法树,进而使得生成的总语法树满足控制约束表,且使得由该总语法树转换的高级语言代码的也满足要求,且产生的代码量较少,相关性较好,提高生成的高级语言代码的有效价值。In this embodiment, in the process of constructing the main tree from the subtrees and finally merging them into the total syntax tree, since each subtree must satisfy the control constraint table, the controllability of the process of constructing the syntax tree from the subtrees is increased, and it is fast. Converge to the total syntax tree, and then make the generated total syntax tree meet the control constraint table, and make the high-level language code converted from the total syntax tree also meet the requirements, and the amount of generated code is less, the correlation is better, and the generated A valid value of the high-level language code for .

S107,遍历读取语法树,并生成相应的可执行高级语言代码文件。S107, traversing and reading the syntax tree, and generating a corresponding executable high-level language code file.

本实施方式中,如果用户设定了特定标注或者注释信息时,还在该可执行高级语言代码生成对应于该特定标注或者注释信息的可执行高级语言代码,以提供在标准语言基础上增加其他信息量标注的接口。In this embodiment, if the user sets specific annotation or annotation information, the executable high-level language code corresponding to the specific annotation or annotation information is also generated from the executable high-level language code, so as to provide additional information on the basis of the standard language. An interface for information volume labeling.

S109,遍历读取语法树的同时,记录生成的高级语言代码的特性,并生成相应的高级语言代码特性描述文件。S109, while traversing and reading the syntax tree, record the characteristics of the generated high-level language code, and generate a corresponding high-level language code characteristic description file.

本实施方式通过记录生成的高级语言代码的特性,生成相应的高级语言代码特性描述文件,从而使得用户通过高级语言代码特性描述文件了解产生的高级语言代码的特性,进而便于检查自己的验证或测试策略是否与代码对应,同时可以根据该高级语言特性描述文件中高级语言代码的特性描述,指导验证或测试策略的实施,减轻了人工编写代码的压力。In this embodiment, by recording the characteristics of the generated high-level language code, a corresponding high-level language code characteristic description file is generated, so that users can understand the characteristics of the generated high-level language code through the high-level language code characteristic description file, and then it is convenient to check their own verification or testing Whether the policy corresponds to the code, and at the same time, according to the feature description of the high-level language code in the high-level language feature description file, it can guide the implementation of the verification or test strategy, reducing the pressure of manual code writing.

S1011,根据该高级语言代码特性描述文件,检测该高级语言代码特性描述文件是否满足控制约束表,如果满足,则执行步骤S1013a;否则执行步骤S1013b。S1011. According to the high-level language code characteristic description file, detect whether the high-level language code characteristic description file satisfies the control constraint table, and if so, execute step S1013a; otherwise, execute step S1013b.

S1013a,生成并输出相应的符合度报告,同时输出可执行高级语言代码文件和高级语言代码特性描述文件。S1013a, generating and outputting a corresponding compliance report, and simultaneously outputting an executable high-level language code file and a high-level language code characteristic description file.

S1013b,进行相应的调整,并生成新的可执行高级语言代码文件。S1013b, making corresponding adjustments, and generating a new executable high-level language code file.

本实施方式,通过核对高级语言代码特性描述文件是否满足控制约束表,来判断生成的可执行高级语言代码是否符合需要,当符合需要时,则输出相应的可执行高级语言代码、高级语言代码特性描述文件和符合度报告;当不符合需要时,则在允许迭代次数前提下,自动调整相应的设置,重新生成新的可执行高级语言代码。In this embodiment, by checking whether the high-level language code characteristic description file satisfies the control constraint table, it is judged whether the generated executable high-level language code meets the requirements. When it meets the requirements, the corresponding executable high-level language code and high-level language code characteristic Description file and compliance report; when it does not meet the requirements, automatically adjust the corresponding settings under the premise of the number of iterations allowed, and regenerate a new executable high-level language code.

本实施方式的高级语言代码生成方法,首先,将输入的语法支持情况描述信息和验证或者测试策略的策略级描述信息,分别转换为相应的语法配置表和控制约束表;其次,根据该语法配置表和控制约束表,调用语法库内的语法和词法元素,并通过语法树构建方法构建相应的语法树;再者,通过遍历读取该语法树,生成相应的可执行高级语言代码文件;同时记录生成的高级语言代码文件的特性,生成相应的高级语言代码特性描述文件,同时,本实施方式通过构建语法树,再将其转换为相应的可执行高级语言代码,由于该语法树满足控制约束表的要求,使得由子树到总语法树的组建过程中可控性增加,且尽快在满足控制约束条件的前提下收敛,从而使得在满足用户控制条件的前提下产生的代码精简,且有良好的相关性和随机性,使得更自然地模拟实际算法代码,保证了产生的高级语言代码测试用例的直接可执行性,进而减轻了人工编写代码的压力。In the high-level language code generation method of this embodiment, first, the input syntax support description information and the strategy-level description information of the verification or test strategy are respectively converted into corresponding syntax configuration tables and control constraint tables; secondly, according to the syntax configuration table and control constraint table, call the grammar and lexical elements in the grammar library, and construct the corresponding grammar tree through the grammar tree construction method; moreover, read the grammar tree by traversing to generate the corresponding executable high-level language code file; at the same time Record the characteristics of the generated high-level language code file, and generate a corresponding high-level language code feature description file. At the same time, this embodiment converts it into a corresponding executable high-level language code by constructing a syntax tree. Since the syntax tree satisfies the control constraints The requirements of the table increase the controllability in the process of building from the subtree to the total syntax tree, and converge as soon as possible under the premise of satisfying the control constraints, so that the code generated under the premise of satisfying the user's control conditions is simplified and has a good The correlation and randomness of the algorithm make it more natural to simulate the actual algorithm code, ensuring the direct executable of the generated high-level language code test cases, thereby reducing the pressure of manual code writing.

以上内容是结合具体的实施方式对本发明所作的进一步详细说明,不能认定本发明的具体实施只局限于这些说明。对于本发明所属技术领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干简单推演或替换,都应当视为属于本发明的保护范围。The above content is a further detailed description of the present invention in conjunction with specific embodiments, and it cannot be assumed that the specific implementation of the present invention is limited to these descriptions. For those of ordinary skill in the technical field of the present invention, without departing from the concept of the present invention, some simple deduction or replacement can be made, which should be regarded as belonging to the protection scope of the present invention.

Claims (8)

1. a higher-level language code generator, is characterized in that, comprising:
Grammer configuration module, supports situation descriptor for receiving the grammer of the electronic design automation tool of input, and supports situation descriptor to be converted to corresponding grammer allocation list described grammer;
Control parameter extraction module, for receiving the checking of input or the strategy level descriptor of Test Strategy, and the strategy level descriptor of described checking or Test Strategy is converted into corresponding control restriction table;
Higher level lanquage syntax library, for storing all grammers of the higher level lanquage of needs and lexical element description;
Syntax tree generation module, be connected with described grammer configuration module, higher level lanquage syntax library and control parameter extraction module, for the grammer allocation list generating according to described grammer configuration module, and the control restriction table of described parameter extraction module generation, call grammer and lexical element in described higher level lanquage syntax library, and generate corresponding syntax tree;
Code generation module, is connected with described syntax tree generation module, for the syntax tree that described syntax tree generation module is generated, is converted to accordingly and can carries out higher-level language code file;
Described syntax tree generation module comprises:
Subtree set generates submodule, be connected with higher level lanquage syntax library with described grammer configuration module, control parameter extraction module, be used for according to described grammer allocation list and control restriction table, class sign or the example of grammer in higher level lanquage syntax library or lexical element of take is node, generates corresponding subtree set;
Subtree merges submodule, generating submodule with described grammer configuration module, control parameter extraction module with subtree set is connected, be used for according to described grammer allocation list and control restriction table, at random each subtree is merged, obtain new subtree set, the leaf node type that the condition of merging is set with another stalk for the root node of the stalk tree in the two stalk trees that will merge is identical;
Total syntax tree generates submodule, merge submodule, grammer configuration module and control parameter extraction module with described subtree and be connected, for using the maximum subtree of the new subtree set node obtaining as main tree, other subtrees are as attached tree, and according to described grammer allocation list and control restriction table, according to the direction of bottom-up extension, at random described main tree and attached tree are carried out to many wheel merging, obtain corresponding total syntax tree.
2. higher-level language code generator as claimed in claim 1, it is characterized in that, described code generation module also, for according to described syntax tree, generates corresponding to the described higher-level language code characteristic description file of carrying out higher-level language code file, and described code generation module comprises:
Code construction submodule, is connected with described syntax tree generation module, for the syntax tree that described syntax tree generation module is generated, travels through and reads, and generates the corresponding higher-level language code carried out file;
Code feature extraction submodule, be connected with degree of conformity detection module with described code construction submodule, for the characteristic of the higher-level language code carried out that record produces when described code construction submodule traversal reads described syntax tree, and produce corresponding higher-level language code characteristic description file.
3. higher-level language code generator as claimed in claim 2, is characterized in that, when the specific mark of needs or annotation information, described code construction submodule also for increasing the interface of other quantity of information marks on standard language basis.
4. higher-level language code generator as claimed in claim 2, is characterized in that, also comprises:
Degree of conformity detection module, be connected with control parameter extraction module with described code feature extraction submodule, be used for according to described higher-level language code characteristic description file, and described control restriction table carries out degree of conformity and checks, if described higher-level language code characteristic description file meets described control restriction table, generate the report of corresponding degree of conformity, and export described degree of conformity report, can carry out higher-level language code file and high-level code characteristic description file; When if described higher-level language code characteristic description file does not meet described control restriction table, according to the iterations of the permission setting in advance, automatically adjust inner setting, regenerate the new higher-level language code carried out file.
5. the higher-level language code generator as described in any one in claim 1 to 4, is characterized in that, described grammer allocation list comprises: grammer point support information, way of realization constraint information, special grammar phenomenon constraint information; Described control restriction table comprises: process-oriented layout's information of program, variable uses information.
6. a higher-level language code generation method, is characterized in that, comprising:
According to the grammer of the electronic design automation tool of input, support situation descriptor, generate corresponding grammer allocation list;
Strategy level descriptor according to the checking of input or Test Strategy, generates the corresponding restriction table of controlling;
According to described grammer allocation list and control restriction table, call grammer and lexical element in higher level lanquage syntax library, and build corresponding syntax tree by syntax tree construction method;
Described syntax tree is converted to accordingly and can carries out higher-level language code file;
Described syntax tree construction method comprises:
According to described control restriction table and grammer allocation list, class sign or the example of grammer or lexical element of take is node, generates corresponding basic subtree set at random;
According to described control restriction table and grammer allocation list, at random each subtree is merged, generate new subtree set, the leaf node type that the condition of merging is set with another stalk for the root node of the stalk tree in the two stalk trees that will merge is identical;
Using the maximum subtree of node as main tree, other subtree is as attached tree, according to described control restriction table and grammer allocation list, according to the direction of bottom-up extension, at random described main tree and attached tree carried out to many wheels and merges, and generates corresponding total syntax tree.
7. method as claimed in claim 6, is characterized in that, described syntax tree is converted to and can carries out accordingly higher-level language code file and comprise:
Traversal reads described syntax tree, generates and can carry out higher-level language code file accordingly;
When having set specific mark or annotation information, described, generate the higher-level language code corresponding to described specific mark or annotation information in carrying out higher-level language code file.
8. method as claimed in claim 7, is characterized in that, also comprises:
When traversal reads described syntax tree, the characteristic of the higher-level language code carried out that record generates, and generate corresponding higher-level language code characteristic description file;
Detect described higher-level language code characteristic description file and whether meet described control restriction table, if met, generate and export corresponding degree of conformity report, described in output, can carry out higher-level language code file and higher-level language code characteristic description file simultaneously; Otherwise adjust accordingly, and generate the new higher-level language code carried out file.
CN201110115605.1A 2011-05-05 2011-05-05 Senior language code generation method and generator Expired - Fee Related CN102156655B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110115605.1A CN102156655B (en) 2011-05-05 2011-05-05 Senior language code generation method and generator

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110115605.1A CN102156655B (en) 2011-05-05 2011-05-05 Senior language code generation method and generator

Publications (2)

Publication Number Publication Date
CN102156655A CN102156655A (en) 2011-08-17
CN102156655B true CN102156655B (en) 2014-04-02

Family

ID=44438163

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110115605.1A Expired - Fee Related CN102156655B (en) 2011-05-05 2011-05-05 Senior language code generation method and generator

Country Status (1)

Country Link
CN (1) CN102156655B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9880842B2 (en) 2013-03-15 2018-01-30 Intel Corporation Using control flow data structures to direct and track instruction execution
CN109739758B (en) * 2018-12-28 2022-02-01 北京云测信息技术有限公司 Test case conversion method and device
KR102777276B1 (en) * 2019-06-04 2025-03-10 삼성전자주식회사 System including fpga and method of operation thereof
CN112269566B (en) * 2020-11-03 2022-09-02 支付宝(杭州)信息技术有限公司 Script generation processing method, device, equipment and system

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1368693A (en) * 2001-02-07 2002-09-11 友邦软件技术有限公司 Method and apparatus for globalizing software
CN101841515A (en) * 2009-03-19 2010-09-22 北京理工大学 Method for realizing automatic generation of protocol data unit coding and decoding codes with variable targets

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1368693A (en) * 2001-02-07 2002-09-11 友邦软件技术有限公司 Method and apparatus for globalizing software
CN101841515A (en) * 2009-03-19 2010-09-22 北京理工大学 Method for realizing automatic generation of protocol data unit coding and decoding codes with variable targets

Also Published As

Publication number Publication date
CN102156655A (en) 2011-08-17

Similar Documents

Publication Publication Date Title
CN102663103B (en) Configurable method for automatically generating database and accessing data
JP5072882B2 (en) Circuit specification description visualization apparatus and circuit specification description visualization method
CN104360859B (en) A kind of visual service development method and system
US20080109780A1 (en) Method of and apparatus for optimal placement and validation of i/o blocks within an asic
JP2007304998A (en) Source code generation method, device, and program
CN102156655B (en) Senior language code generation method and generator
CN107609302B (en) Method and system for generating product process structure
CN107908394A (en) A kind of data interchange format source code generation method and instrument
CN106294148B (en) C programmer software verification method and device based on escape character transition system
KR101770292B1 (en) Computer-executable model reverse engineering method and apparatus performing the same
WO2023087720A1 (en) Applet generation method and apparatus, device and storage medium
US9524366B1 (en) Annotations to identify objects in design generated by high level synthesis (HLS)
CN104050087A (en) Software architecture correctness verification method based on UML model
US20220171932A1 (en) Automated translation of design specifications of electronic circuits
US8887083B2 (en) Generating equations based on user intent
US7917873B1 (en) System and method for verification of integrated circuit design
CN102521250B (en) Method for implementing universal syntactic analysis of intelligent measuring instrument
US7984398B1 (en) Automated multiple voltage/power state design process and chip description system
CN104281604A (en) Method and system for generating Target Link data dictionary hierarchical tree
JP2013214278A (en) Upper hierarchy description generating apparatus, method for generating upper hierarchy description, and program
CN118484191A (en) A graphical user interface generation method and device
Dall'Ora et al. A common manipulation framework for transistor-level languages
CN117610491A (en) Chip design method, device, equipment and computer readable storage medium
CN110554860A (en) Construction method and code generation method of software project natural language programming interface (NLI)
CN101055521B (en) Mapping rule visualized generation method and system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20140402

Termination date: 20200505

CF01 Termination of patent right due to non-payment of annual fee