PEG-based method for multi-level conversion of aadl code to graphs

By using a PEG-based approach, the syntax rules of AADL code are defined and a multi-level AST is generated, which solves the problems of low efficiency and poor scalability of multi-level graphical display of embedded system architecture, and achieves efficient graphical display and good system applicability.

CN120029667BActive Publication Date: 2025-12-12BEIJING INST OF COMP TECH & APPL
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510187569.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-20
Publication Date
2025-12-12
Estimated Expiration
2045-02-20

AI Technical Summary

Technical Problem

In existing technologies, the multi-layered graphical display and parsing of embedded system architectures is inefficient, inflexible, and lacks scalability, making it difficult to meet the needs of complex system designs.

Method used

The method uses PEG to define the syntax rules of AADL code, build a parser and generate a multi-level abstract syntax tree (AST), and then convert it into a graphical representation. This process includes defining PEG syntax rules, building an AADL code parser, generating a multi-level AST, and converting it into a graphical representation.

Benefits of technology

It significantly improves the efficiency of AADL code parsing, clearly presents the relationships between different levels of the system, facilitates analysis and modification, and has good scalability and compatibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120029667B_ABST
    Figure CN120029667B_ABST
Patent Text Reader

Abstract

The present application relates to a kind of PEG-based AADL code to graph multilevel conversion method, belong to embedded system architecture modeling and analysis field.The present application defines PEG grammar rule.The grammar rule can accurately describe the basic element of AADL language, recursive structure and grammar priority;Build AADL code parser;Based on the defined PEG grammar rule, the parser can be built layer by layer AADL code, identify each design element, and capture and feedback grammar semantic problem in the parsing process;Generation multilevel abstract syntax tree AST.AST can clearly express the node construction of AADL, hierarchical nesting, attribute mapping and element relationship.The fourth step, multilevel abstract syntax tree AST is converted into graphical expression.Each level of system architecture is intuitively presented by graphical way.The present application can clearly present the hierarchical relationship between different design elements, facilitate designer and developer to analyze, understand and modify.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the field of embedded system architecture modeling and analysis, and specifically relates to a PEG-based AADL code to graphical multi-level conversion method. BACKGROUND

[0002] With the continuous development of system design and requirement analysis, the model-based system engineering (MBSE) method has been widely used in the development of embedded systems. MBSE promotes the whole life cycle management from requirement analysis, architecture design to verification by constructing models instead of relying on traditional documents. In the fields of aerospace, automotive, defense, etc., MBSE has become an important means to improve system design efficiency and ensure system consistency and traceability. By adopting model-driven development, MBSE can effectively cope with increasingly complex system architectures and solve the problems of information silos and collaboration difficulties in traditional development methods.

[0003] Under the framework of MBSE, the modeling and analysis of embedded system architecture is an important part. Through modeling languages such as AADL (Architecture Analysis and Design Language), users can model, analyze and verify system architecture. This model-based design method can help engineers better understand system architecture and optimize system design. However, as the complexity of system architecture continues to increase, how to effectively parse and display these complex architectures, especially support multi-level graphical display, becomes an important challenge in system architecture analysis.

[0004] The application is dedicated to filling the gap in the field of aerospace in China based on model-based system architecture design tools. The method proposed by the application can help engineers intuitively and clearly view the hierarchical structure of the system and the relationship between each component, quickly identify potential problems and optimize them, thereby significantly improving the efficiency and accuracy of architecture design. SUMMARY

[0005] (I) Technical problems to be solved

[0006] The technical problem to be solved by the application is how to provide a PEG-based AADL code to graphical multi-level conversion method to solve the problem of effectively parsing and displaying these complex architectures, especially supporting multi-level graphical display.

[0007] (II) Technical solutions

[0008] In order to solve the above technical problems, the application provides a PEG-based AADL code to graphical multi-level conversion method, which includes the following steps:

[0009] Step 1, define PEG syntax rules

[0010] define the PEG grammar rules suitable for AADL code parsing, which is used to accurately describe the hierarchy and nested relationship of AADL language by recursively defining each syntax content;

[0011] Second step, build AADL code parser

[0012] Based on the defined PEG grammar rules, build AADL code parser, which is used to parse AADL code layer by layer, identify each design element, and capture and feedback syntax semantic problems during the parsing process;

[0013] Third step, generate multi-level abstract syntax tree AST

[0014] The parser generates a multi-level abstract syntax tree AST according to the structure of the AADL code, which is used to express the node construction, hierarchical nesting, attribute mapping and element relationship of AADL;

[0015] Fourth step, convert the multi-level abstract syntax tree AST into graphical expression

[0016] Convert the multi-level abstract syntax tree AST into graphical display, through the graphical way, each level of the system architecture is intuitively presented.

[0017] (Three) beneficial effects

[0018] The present application proposes a kind of AADL code to graph multi-level conversion method based on PEG, which has the following characteristics:

[0019] (1) The parsing method based on PEG significantly improves the efficiency of AADL code parsing, and adapts to different scale and complexity of system design requirements.

[0020] (2) By converting the parsed multi-level abstract syntax tree (AST) into graphical display, the hierarchical relationship between different design elements, such as system, subsystem, component and interface, can be clearly presented. Make the complex structure more intuitive, easy for designers and developers to analyze, understand and modify.

[0021] (3) The AST system based on PEG has good expansibility, which can adapt to different versions of AADL language by simply adjusting the grammar rules and parser modules. Ensure the long-term applicability and compatibility of the system. DETAILED DESCRIPTION

[0022] Figure 1 Flow chart of the method of the present application;

[0023] Figure 2For Peggy.js-based implementation example;

[0024] Figure 3 For the generated AST structure diagram of the parser;

[0025] Figure 4 For the diagrammatic table diagram converted from the AST. DETAILED DESCRIPTION

[0026] In order to make the purpose, content and advantages of the present application clearer, the specific embodiments of the present application are described in further detail below in combination with the drawings and examples.

[0027] The present application relates to embedded system architecture modeling and analysis technology in the field of MBSE (Model-Based Systems Engineering). Specifically, the present application provides a PEG (Parsing Expression Grammar) based AADL (Architecture Analysis and Design Language) code to graphical multi-level conversion method, which can convert the architecture model described by AADL into a visual graphical representation by parsing and converting the architecture model described by AADL. It is the core technical module of the MBSE tool chain independently developed by our unit.

[0028] The present application provides a PEG based AADL code to graphical multi-level conversion method, which solves the problems of low parsing efficiency, inflexible graphical display and poor extensibility in the prior art. The core steps of the method are as follows: first, define the PEG grammar rule. The grammar rule can accurately describe the basic elements, recursive structure and grammar priority of the AADL language. Second, build an AADL code parser. Based on the defined PEG grammar rule, the parser can parse the AADL code layer by layer, identify various design elements (such as packages, components, interfaces, etc.), and capture and feedback syntax semantic problems during the parsing process. Third, generate a multi-level abstract syntax tree (AST). The AST can clearly express the node structure, hierarchical nesting, attribute mapping and element relationship of AADL. Fourth, convert the multi-level abstract syntax tree AST into a graphical representation. Through graphical representation, each level of the system architecture is intuitively presented.

[0029] The present application provides a PEG based AADL code to graphical multi-level conversion method. The specific implementation steps are as follows (as shown in Figure 1

[0030] First step, define PEG grammar rule

[0031] ​The present application first defines a set of PEG grammar rules suitable for AADL code parsing. The grammar rules define each syntax content recursively, ensuring that the hierarchical structure and nested relationship of the AADL language can be accurately described. The specific grammar rules include:

[0032] (1) Basic elements: Define the smallest constituent units such as identifiers, keywords, etc.

[0033] (2) Recursive structure: By recursively defining combination rules, complex nested structures and hierarchical relationships are handled.

[0034] (3) Syntax priority: Set reasonable priority to ensure the correctness of syntax parsing.

[0035] Second step, build AADL code parser

[0036] Based on the aforementioned PEG grammar rules, an AADL code parser is constructed. The functions of the parser include:

[0037] (1) Code decomposition: According to the PEG rules, parse the AADL code layer by layer, and cut the code into multiple hierarchical structures to identify each element.

[0038] (2) Recursive parsing: Through recursive descent, each sub-element in the multi-level structure is parsed step by step.

[0039] (3) Error capture and feedback: In the parsing process, if a syntax error or non-standard structure is encountered, the parser can immediately return error information, providing error location and type.

[0040] Third step, build multi-level abstract syntax tree (AST)

[0041] The multi-level abstract syntax tree AST is an accurate representation of the hierarchical structure in the AADL code. The parser generates a multi-level abstract syntax tree AST according to the structure of the AADL code. The structure of the AST has the following characteristics:

[0042] (1) Node construction: Each node of the AST represents an element in the AADL code. The node contains its ID, type, attributes, and relationship with other nodes.

[0043] (2) Hierarchical nesting: The AST is a recursive structure, and the relationship between nodes and child nodes represents the hierarchical relationship between different design elements. For example, the system node is the top-level node, its child nodes are subsystems, the child nodes of the subsystems are specific components, and so on.

[0044] (3) Attribute mapping: Each node is attached with corresponding attribute information, such as the ports of components, parameters of interfaces, etc. These attributes help further analyze the system structure.

[0045] (4) Element Relationship: The connections between nodes represent the relationships between different design elements (such as communication between components, invocation relationship of interfaces, etc.).

[0046] Step 4, AST conversion to graphical representation

[0047] By converting the multi-level abstract syntax tree AST to a graphical display, the various levels of the system can be intuitively presented. This conversion process includes:

[0048] (1) Generate tree structure diagram: Convert AST to tree structure diagram to express the hierarchical structure between elements.

[0049] (2) Component relationship diagram: Express the relationship between components, subsystems, and their ports, interfaces in a graphical manner, which is convenient for subsequent analysis and modification.

[0050] Example 1:

[0051] The specific steps of implementing the PEG-based AADL code to graphical multi-level conversion tool are as follows:

[0052] Step 1, define PEG grammar rules

[0053] First, define the PEG grammar rules suitable for AADL code parsing, and the implementation example based on Peggy.js is shown in Figure 2 The file name is aadl.peggy.

[0054] (1) Basic elements

[0055] Basic elements are the smallest components in PEG grammar. Identifier definition such as CommonIdentifier is used to match component names, property names, etc. in AADL; keywords such as Category are used to match reserved keywords in AADL.

[0056] (2) Recursive structure

[0057] The hierarchical structure and nested relationship in AADL code are described by recursion, such as Package, which is a recursive structure containing multiple PackageContent, which can be CommonImplementation or CommonDefinition, which are also recursive structures, respectively composed of 0 to multiple ImplementationSubContents and TypeSubContents.

[0058] (3) Syntax priority

[0059] The priority of rules in PEG is determined by the order of rules. For example, if a Category contains multiple keywords, the order of rules will parse data first and then other keywords in order.

[0060] Second step, building AADL code parser

[0061] According to the PEG rule file aadl.peggy written in the first step, the decomposition and recursive parsing of AADL code is implemented using Peggy.js. During the parsing process, exceptions output (such as exceptions thrown by nameMatchCheck) can be identified and error printing can be performed to identify the specific error location and type.

[0062] Third step, building multi-level abstract syntax tree (AST)

[0063] The AST structure generated by the parser is shown in Figure 3 The multi-level abstract syntax tree AST is composed of AADLNode nodes, which represent an element in the AADL code. Each AADLNode node contains the following information:

[0064] (1) ID represents the unique identification of each node.

[0065] (2) Type represents the type of the node, which can be a device, processor, memory, thread, connection, etc.

[0066] (3) Attributes contains attribute mapping information of the node, such as name, properties, features, etc.

[0067] (4) Relation represents the relationship between different elements, such as inclusion relationship, dependency relationship, interaction relationship, inheritance relationship, etc.

[0068] (5) Children represents the child nodes of the node, each child node is also a complete AADLNode, expressing the hierarchical relationship between the node and the child node.

[0069] Fourth step, AST converted into graphical expression

[0070] The AST in the third step is converted into a tree structure diagram and a component relationship diagram to visually display the hierarchical structure of the AADL system construction and the relationship between elements, as shown in Figure 4 .

[0071] Example 2:

[0072] The application provides a PEG-based AADL code to graph multi-level conversion method, which solves the problems of low parsing efficiency, inflexible graph display and poor expansibility in the prior art.

[0073] The first step is to define a PEG grammar rule. The grammar rule can accurately describe the basic elements, recursive structure and grammar priority of the AADL language.

[0074] The second step is to build an AADL code parser. Based on the defined PEG grammar rule, the parser can parse the AADL code layer by layer, identify various design elements (such as packages, components, interfaces, etc.), and capture and feedback the grammar semantic problems in the parsing process.

[0075] The third step is to generate a multi-level abstract syntax tree (AST). The AST can clearly express the node construction, hierarchical nesting, attribute mapping and element relationship of AADL.

[0076] The fourth step is to convert the multi-level abstract syntax tree AST into a graphical expression. Through the graphical method, each level of the system architecture is intuitively presented.

[0077] Advantages

[0078] The application provides a PEG-based AADL code to graph multi-level conversion method, which has the following characteristics:

[0079] (1) The PEG-based parsing method significantly improves the efficiency of AADL code parsing, and adapts to different size and complexity of system design requirements.

[0080] (2) By converting the parsed multi-level abstract syntax tree (AST) into a graphical display, the hierarchical relationship between different design elements, such as system, subsystem, component and interface, can be clearly presented. The complex structure is more intuitive, which is convenient for designers and developers to analyze, understand and modify.

[0081] (3) The AST system based on PEG has good expansibility, and can adapt to different versions of AADL language by simply adjusting the grammar rule and parser module. The long-term applicability and compatibility of the system are ensured.

[0082] The above only describes the preferred embodiments of the application, and it should be pointed out that for ordinary skilled persons in the technical field, some improvements and modifications can be made without departing from the technical principles of the application, and these improvements and modifications should be regarded as the protection scope of the application.

Claims

1. A PEG-based method for multi-level conversion of AADL code to graphs, characterized in that, The method comprises the following steps: First step, define PEG grammar rules Define PEG grammar rules suitable for AADL code parsing, which is used to accurately describe the hierarchical structure and nested relationship of AADL language by recursively defining each syntax content; Second step, build AADL code parser Based on the defined PEG grammar rules, build an AADL code parser, which is used to parse AADL code layer by layer, identify each design element, and capture and feedback syntax semantic problems during parsing; Third step, generate multi-level abstract syntax tree AST The parser generates a multi-level abstract syntax tree AST according to the structure of the AADL code, which is used to express the node construction, hierarchical nesting, attribute mapping and element relationship of AADL; Fourth step, convert the multi-level abstract syntax tree AST into graphical expression Convert the multi-level abstract syntax tree AST into graphical display, and intuitively present each level of the system architecture through graphical display; Among them, In the third step, Node construction: each node of AST represents an element in AADL code, and the node contains its ID, type, attribute and relationship with other nodes; Hierarchical nesting: AST is a recursive structure, and the relationship between nodes and child nodes represents the hierarchical relationship between different design elements; Attribute mapping: each node is attached with corresponding attribute information; Element relationship: the connection between nodes represents the relationship between different design elements.

2. The PEG-based AADL code to graphical multi-level transformation method of claim 1, wherein, In the first step, the grammar rules include: basic elements, recursive structure and syntax priority; Basic elements: define the minimum unit of identifier and keyword; Recursive structure: define the combination rule recursively to handle complex nested structure and hierarchical relationship; Syntax priority: set reasonable priority, the priority of rules in PEG is determined by the order of rules, to ensure the correctness of syntax parsing.

3. The PEG-based AADL code to graphical multi-level transformation method of claim 2, wherein, Identifiers are used to match component names and attribute names in AADL; keywords are used to match reserved keywords in AADL.

4. The PEG-based AADL code to graphical multi-level transformation method of claim 1, wherein, The parser in the second step is used for code decomposition, recursive parsing and error capture and feedback; Code decomposition: parse AADL code layer by layer according to PEG rules, divide the code into multiple hierarchical structures, and identify each element; Recursive parsing: parse each sub-element in the multi-level structure by recursive descent; Error capture and feedback: if a syntax error or non-standard structure is encountered during parsing, the parser can return error information immediately, providing error location and type.

5. The PEG-based AADL code to graphical multi-level conversion method of claim 4, wherein, According to the PEG rule file aadl.peggy written in the first step, AADL code decomposition and recursive parsing are realized using Peggy.js, which can identify abnormal output and print errors during parsing, and identify specific error location and type.

6. The PEG-based AADL code to graphical multi-level transformation method of claim 4, wherein, The third step includes: the multi-level abstract syntax tree AST is composed of AADLNode nodes, and each AADLNode node represents an element in AADL code, and each AADLNode node contains the following information: ID represents the unique identification of each node; Type represents the type of the node, including: device, processor, memory, thread and connection; Attributes contains attribute mapping information of the node, including: name, attribute and feature; Relation represents the relationship between different elements, including: containment relationship, dependency relationship, interaction relationship and inheritance relationship; Children represents the child nodes of the node, each child node is also a complete AADLNode, expressing the hierarchical relationship between the node and the child node.

7. The PEG-based AADL code to graphical multi-level conversion method of claim 4, wherein, In hierarchical nesting, the system node is the topmost node, its child node is the subsystem, and the child node of the subsystem is the specific component.

8. The PEG-based AADL code to graphical multi-level conversion method of claim 4, wherein, In element relationship, the relationship between elements includes: communication between components, calling relationship of interfaces.

9. The PEG-based AADL code to graphical multi-level transformation method of claim 4, wherein, The fourth step includes: Generating a tree structure diagram: converting AST into a tree structure diagram to express the hierarchical structure between elements; Component relationship diagram: expressing the relationship between components, subsystems and their ports, interfaces in a graphical manner, facilitating subsequent analysis and modification.

Citation Information

Patent Citations

  • AADL-based method for establishing, analyzing and simulating hybrid system model

    CN103942086A