Language information visualization method and device

Automatically obtain and build a visual model of source language information through syntax tree document technology, which solves the problems of high cost and omission errors in the existing technology, and improves the accuracy and efficiency of the model.

CN114416065BActive Publication Date: 2024-09-24BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111585293.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-22
Publication Date
2024-09-24
Estimated Expiration
2041-12-22

AI Technical Summary

Technical Problem

In the existing technology, the labor cost and time cost of building a source language information visualization model are high, and manual construction can easily cause omissions and errors, affecting the model effect.

Method used

By obtaining the syntax tree document of the source language information, automatically obtain the assignment expression node and call expression node, determine the class identifier, variable name and function name of the class, build a visual model of the source language information, and automatically draw the model using syntax tree document technology.

Benefits of technology

It reduces the labor and time costs of building a visual model, avoids omissions and errors during manual construction, and improves the accuracy and efficiency of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114416065B
    Figure CN114416065B
Patent Text Reader

Abstract

The present application provides a method and device for visualizing language information, including: obtaining source language information, and converting the source language information into a syntax tree document, obtaining an assignment expression node from the syntax tree document, and determining the class identifier of the class, as well as the variable name and function name of the class according to the assignment expression node, obtaining a call expression node from the syntax tree document, and determining the class identifiers of other classes associated with the class according to the call expression node, and constructing a visualization model of the source language information according to the class identifier, variable name, function name, and class identifiers of other classes associated with the class. The embodiment of the present application automatically obtains the identifiers, member names, and call relationships of each class in the source language information by utilizing syntax tree document technology, and automatically draws a visualization model of the source language information, thereby reducing the manpower cost and time cost of constructing a visualization model of the source language information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and in particular, to a language information visualization method, device, electronic device, computer-readable storage medium, and computer program product. Background Art

[0002] With the continuous development of computer technology, the complexity of computer software is also increasing. In order to better help technicians understand the software source language information, a corresponding visualization model is usually built based on the software source language information so that technicians can quickly and intuitively understand the software source language information.

[0003] In the related art, a technician who is familiar with the software source language information usually deconstructs the software source language information, determines the calling relationship and properties between each class and each function in the software source language information, and then uses graphics drawing software to draw a visualization model.

[0004] However, in the current solution, for large projects, manually drawing a visualization model of the software source language information results in excessive investment in manpower and time costs, and the drawing process is relatively complicated. Manual drawing is prone to omissions and errors, which affect the final effect of the visualization model. Summary of the invention

[0005] The embodiments of the present application provide a language information visualization method, device, electronic device, computer-readable storage medium and computer program product to solve the problems in the related art that the manpower cost and time cost of constructing a source language information visualization model are too high, and the manual construction of the source language information visualization model is prone to omissions and errors, which affects the effect of the visualization model.

[0006] In a first aspect, an embodiment of the present application provides a method for visualizing language information, the method comprising:

[0007] Acquire a syntax tree document corresponding to the source language information, wherein the syntax tree document includes a plurality of nodes forming a tree structure, and the nodes are used to represent the syntax structure of the language information fragment in the source language information;

[0008] Obtaining an assignment expression node from the syntax tree document, and determining a class identifier of a class, and a variable name and a function name of the class according to the assignment expression node; the assignment expression node is used to define the class's own attributes;

[0009] Acquire a call expression node from the syntax tree document, and determine class identifiers of other classes associated with the class according to the call expression node; the call expression node is used to define the association relationship between the class and the other classes;

[0010] A visualization model of the source language information is constructed based on the class identifier, variable name, function name of the class and the class identifiers of other classes associated with the class. The visualization model is used to display the variable name, function name of the class and the association relationship between classes.

[0011] In an optional implementation, the step of obtaining an assignment expression node from the syntax tree document and determining a class identifier of a class, and a variable name and a function name of the class according to the assignment expression node; the assignment expression node is used to define the class's own attributes, including:

[0012] Obtain the assignment expression node from the syntax tree document;

[0013] Determine a first expression node of a class initialization node type from the assignment expression nodes, and determine a class identifier of the class from the first expression node;

[0014] Determine a second expression node whose type is a member variable assignment node from the assignment expression node, and obtain the variable name of the class from the second expression node;

[0015] A third expression node whose type is a member function assignment node is determined from the assignment expression nodes, and the function name of the class is obtained from the third expression node.

[0016] In an optional implementation, determining a first expression node whose type is a class initialization node from the assignment expression node, and determining a class identifier of the class from the first expression node, includes:

[0017] Determine, in the assignment expression node, an assignment expression node including a class identifier on one side of an assignment operator and a function expression on the other side as the first expression node;

[0018] The class identifier included in one side of the first expression node is determined as the class identifier of the class.

[0019] In an optional implementation, determining a second expression node whose type is a member variable assignment node from the assignment expression node, and obtaining the variable name of the class from the second expression node includes:

[0020] Determine, as a second expression node, an assignment expression node at the same level as the first expression node, an assignment expression node whose assignment operator includes a member expression of the class identifier of the class on one side and a numerical expression on the other side; the type of the numerical expression is any one of a literal type, an identifier type and a variable type;

[0021] The variable identifier in the member expression of the second expression node is determined as the variable name corresponding to the class.

[0022] In an optional implementation, the variable name includes a prototype variable name and a static variable name, and determining the variable identifier in the member expression of the second expression node as the variable name corresponding to the class includes:

[0023] In the case where the member expression of the second expression node includes a prototype indication mark, determining the variable identifier in the member expression of the second expression node as the prototype variable name of the class;

[0024] When the prototype indication mark is not included in the member expression of the second expression node, the variable identifier in the member expression of the second expression node is determined as the static variable name of the class.

[0025] In an optional implementation, determining a third expression node whose type is a member function assignment node from the assignment expression node, and obtaining the function name of the class from the third expression node includes:

[0026] Determine, as a third expression node, an assignment expression node at the same level as the first expression node, an assignment expression node whose assignment operator side includes a member expression of the class identifier of the class and whose other side includes a function expression;

[0027] The function identifier in the member expression of the third expression node is determined as the function name of the class.

[0028] In an optional implementation, the function name includes a prototype function name and a static function name, and determining the function identifier in the member expression of the third expression node as the function name of the class includes:

[0029] In the case where the member expression of the third expression node includes a prototype indication mark, determining the function identifier in the member expression of the third expression node as the prototype function name of the class;

[0030] In a case where the member expression of the third expression node does not include the prototype indication mark, the function identifier in the member expression of the third expression node is determined as the static function name of the class.

[0031] In an optional implementation, the other classes associated with the class include inherited classes and dependent classes associated with the class, and obtaining a call expression node from the syntax tree document and determining class identifiers of other classes associated with the class according to the call expression node include:

[0032] Determine a node in the syntax tree document that contains a function call identifier as the call expression node;

[0033] In the case that the number of items of the function parameters of the call expression node is equal to one item, determining the first item parameter of the function parameters in the call expression node as the class identifier of the dependent class of the class;

[0034] When the number of function parameters in the call expression node is equal to or greater than two, and the second parameter of the function parameters in the call expression node matches the class identifier of the class, the first parameter of the function parameters in the call expression node is determined as the class identifier of the inherited class of the class.

[0035] In an optional implementation, the method further includes:

[0036] In the case where the class belongs to a parent class, all second expression nodes and all third expression nodes of the class are obtained; the second expression nodes are used to define variables of the class, and the third expression nodes are used to define functions of the class;

[0037] When the function expressions of all the third expression nodes are null values, and the numerical expressions of all the second expression nodes are null values, the type of the class is determined to be an interface implementation class.

[0038] In an optional implementation manner, constructing a visualization model of the source language information according to the class identifier, variable name, function name of the class and class identifiers of other classes associated with the class includes:

[0039] Constructing an attribute string of the class according to the class identifier, variable name, function name, class identifiers and types of other associated classes of the class;

[0040] The attribute character strings of each class are input into a drawing tool to obtain the visualization model.

[0041] In a second aspect, an embodiment of the present application further provides a language information visualization device, the device comprising:

[0042] A grammar acquisition module is configured to acquire a grammar tree document corresponding to the source language information, wherein the grammar tree document includes a plurality of nodes forming a tree structure, and the nodes are used to represent the grammar structure of the language information segment in the source language information;

[0043] A member determination module is configured to obtain an assignment expression node from the syntax tree document, and determine a class identifier of a class, and a variable name and a function name of the class according to the assignment expression node; the assignment expression node is used to define the class's own attributes;

[0044] A function determination module is configured to obtain a call expression node from the syntax tree document, and determine the class identifier of other classes associated with the class according to the call expression node; the call expression node is used to define the association relationship between the class and the other classes;

[0045] The construction module is configured to construct a visualization model of the source language information according to the class identifier, variable name, function name of the class and the class identifiers of other classes associated with the class, and the visualization model is used to display the variable name, function name of the class and the association relationship between classes.

[0046] In an optional implementation, it is characterized in that the member determination module includes:

[0047] An acquisition submodule, configured to acquire the assignment expression node from the syntax tree document;

[0048] A class identification submodule is configured to determine a first expression node of a class initialization node type from the assignment expression nodes, and determine a class identification of the class from the first expression node;

[0049] A variable name submodule is configured to determine a second expression node of a member variable assignment node type from the assignment expression node, and obtain the variable name of the class from the second expression node;

[0050] The function name submodule is configured to determine a third expression node whose type is a member function assignment node from the assignment expression node, and obtain the function name of the class from the third expression node.

[0051] In an optional implementation, it is characterized in that the class identification submodule includes:

[0052] A first expression submodule is configured to determine, in the assignment expression node, an assignment expression node whose assignment operator side includes a class identifier and whose other side includes a function expression as the first expression node;

[0053] The class identifier determination submodule is configured to determine the class identifier contained in one side of the first expression node as the class identifier of the class.

[0054] In an optional implementation, it is characterized in that the variable name submodule includes:

[0055] A second expression submodule is configured to determine, as a second expression node, an assignment expression node at the same level as the first expression node, an assignment expression node whose one side of the assignment operator contains a member expression of the class identifier of the class and whose other side contains a numerical expression; the type of the numerical expression is any one of a literal type, an identifier type and a variable type;

[0056] The variable name determination submodule is configured to determine the variable identifier in the member expression of the second expression node as the variable name corresponding to the class.

[0057] In an optional implementation, it is characterized in that the variable name includes a prototype variable name and a static variable name, and the variable name determination submodule includes:

[0058] A prototype variable name submodule is configured to determine the variable identifier in the member expression of the second expression node as the prototype variable name of the class when the member expression of the second expression node includes a prototype indication mark;

[0059] The static variable name submodule is configured to determine the variable identifier in the member expression of the second expression node as the static variable name of the class when the member expression of the second expression node does not include the prototype indication mark.

[0060] In an optional implementation, it is characterized in that the function name submodule includes:

[0061] A third expression submodule is configured to determine, as a third expression node, an assignment expression node at the same level as the first expression node, an assignment expression node whose assignment operator side includes a member expression of the class identifier of the class and whose other side includes a function expression;

[0062] The function name determination submodule is configured to determine the function identifier in the member expression of the third expression node as the function name of the class.

[0063] In an optional implementation, it is characterized in that the function name includes a prototype function name and a static function name, and the function name determination submodule includes:

[0064] A prototype function name submodule is configured to determine the function identifier in the member expression of the third expression node as the prototype function name of the class when the member expression of the third expression node includes a prototype indication mark;

[0065] The static function name submodule is configured to determine the function identifier in the member expression of the third expression node as the static function name of the class when the member expression of the third expression node does not include the prototype indication mark.

[0066] In an optional implementation, it is characterized in that the other classes associated with the class include inherited classes and dependent classes associated with the class, and the function determination module includes:

[0067] A call expression submodule is configured to determine a node in the syntax tree document that contains a function call identifier as the call expression node;

[0068] The dependent class submodule is configured to determine the first parameter of the function parameter in the calling expression node as the class identifier of the dependent class of the class when the number of items of the function parameter of the calling expression node is equal to one item;

[0069] The inheritance class submodule is configured to determine the first parameter of the function parameter in the call expression node as the class identifier of the inheritance class of the class when the number of items of the function parameter of the call expression node is equal to or greater than two and the second parameter of the function parameter in the call expression node matches the class identifier of the class.

[0070] In an optional embodiment, it is characterized in that the device further comprises:

[0071] An expression acquisition module, configured to acquire all second expression nodes and all third expression nodes of the class when the class belongs to a parent class; the second expression nodes are used to define variables of the class, and the third expression nodes are used to define functions of the class;

[0072] The interface implementation class module is configured to determine that the type of the class is an interface implementation class when the function expressions of all the third expression nodes are null values ​​and the numerical expressions of all the second expression nodes are null values.

[0073] In an optional implementation, it is characterized in that the building module includes:

[0074] A string submodule is configured to construct an attribute string of the class according to the class identifier, variable name, function name, class identifiers and types of other associated classes of the class;

[0075] A submodule is constructed, and the attribute strings of each class are input into a drawing tool to obtain the visualization model.

[0076] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the language information visualization method.

[0077] In a fourth aspect, an embodiment of the present application further provides a storage medium, which, when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, enables the electronic device to execute the language information visualization method.

[0078] In a fifth aspect, an embodiment of the present application further provides a computer program product, including a computer program, which implements the language information visualization method when executed by a processor.

[0079] In an embodiment of the present application, it includes: obtaining source language information, and converting the source language information into a syntax tree document, obtaining an assignment expression node from the syntax tree document, and determining the class identifier of the class, as well as the variable name and function name of the class according to the assignment expression node, obtaining a call expression node from the syntax tree document, and determining the class identifiers of other classes associated with the class according to the call expression node, and constructing a visualization model of the source language information according to the class identifier, variable name, function name, and class identifiers of other classes associated with the class. The embodiment of the present application automatically obtains the identifiers, member names, and call relationships of each class in the source language information by utilizing syntax tree document technology, and automatically draws a visualization model of the source language information, thereby reducing the labor cost and time cost of constructing a visualization model of the source language information, and avoiding the omissions and errors caused by manually constructing a visualization model of the source language information, resulting in poor visualization model effects.

[0080] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0081] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0082] Figure 1 It is a flow chart of the steps of a language information visualization method provided in an embodiment of the present application;

[0083] Figure 2 It is a structural diagram of a syntax tree provided in an embodiment of the present application;

[0084] Figure 3 is a flowchart of another method for visualizing language information provided by an embodiment of the present application;

[0085] Figure 4 It is a schematic diagram of a source language information visualization model provided in an embodiment of the present application;

[0086] Figure 5 is a block diagram of a language information visualization device provided in an embodiment of the present application;

[0087] Figure 6 is a block diagram of an electronic device according to an embodiment of the present application;

[0088] Figure 7 is a block diagram of an electronic device according to another embodiment of the present application. DETAILED DESCRIPTION

[0089] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.

[0090] Figure 1 is a flow chart of the steps of a language information visualization method provided by an embodiment of the present application, such as Figure 1 As shown, the method may include:

[0091] Step 101: Acquire a syntax tree document corresponding to source language information, wherein the syntax tree document includes a plurality of nodes forming a tree structure, and the nodes are used to represent the syntax structure of a language information segment in the source language information.

[0092] In an embodiment of the present application, the source language information may be information such as characters and codes, and the source language information may be source language information of a project or software built based on a language framework, wherein the language framework may be a language framework such as Google Closure Library or jQuery framework.

[0093] Due to the high complexity of source language information, developers need to first understand the structure of source language information to understand source language information before they can develop and maintain it. However, understanding source language information through the text content of source language information takes a lot of time and experience for developers, which leads to a heavy mental burden for developers and slows down the development progress. In addition, since some language frameworks are relatively unpopular and are not known by most developers, understanding source language information through the text content of source language information may also require developers to pay a lot of learning costs.

[0094] Therefore, the appeal of the embodiments of the present application is to convert the source language information of the project and software into a visual graphic structure. Through this graphic structure, developers can intuitively understand the relationship between various classes in the source language information, as well as various definitions, so that developers can quickly get started with the development of the source language information, improve development and maintenance efficiency, and meet the appeal of long-term low-cost iterative maintenance projects.

[0095] In this step, all project files in the project repository directory may be scanned, and source language information of the project files may be obtained.

[0096] In an embodiment of the present application, a syntax tree document (AST, abstract syntax code) is a tree-like abstract representation of the grammatical structure of the source language information. Each node on the tree represents a structure in the source language information. The embodiment of the present application can automatically modify the language information efficiently and accurately through a series of operations on the syntax tree document nodes.

[0097] Specifically, the embodiment of the present application can use a compiler to convert source language information into a syntax tree document. After the source language information is converted into a syntax tree document, various definitions of classes in the source language information and the relationship between classes can be obtained by modifying the syntax tree document conveniently and quickly. Among them, the compiler can be a Babel compiler, which is a compiler for writing a new generation of JS language information. It has a complete tool chain that provides parsing of source language information into syntax tree documents and traversal conversion of syntax tree documents.

[0098] For example, refer to Figure 2 , which shows a structural schematic diagram of a syntax tree provided in an embodiment of the present application. The syntax tree is composed of 6 nodes (node ​​A-node F), and there is a structural relationship between the nodes. For example, node B is the parent node of node D, which reflects that the execution order of the language information segment corresponding to node B takes precedence over the execution order of the language information segment corresponding to node D; node E is the child node of node C, etc., which reflects that the execution order of the language information segment corresponding to node E is later than the execution order of the language information segment corresponding to node C.

[0099] Specifically, each node is used to represent the grammatical structure of the language information segment in the language information. For example, assuming that the content of node B is: stmt_return; the content of node D is: variable(a). Node B reflects the grammatical structure of the language information segment of the return action in the language information, and node D reflects the grammatical structure of the language information segment of variable a in the language information. Combining nodes B and D implements the logic of returning variable a in the language information.

[0100] Furthermore, due to Figure 2 The structure of the syntax tree shown is a syntax tree document, and the content of each node therein can be obtained. At the same time, the relationship between each node can also be determined through the content in each node. Therefore, the syntax tree can be analyzed to determine the elements in the source language information corresponding to the syntax tree and the relationship between each element, so as to achieve the purpose of efficiently determining the source language information structure.

[0101] Step 102: Obtain an assignment expression node from the syntax tree document, and determine the class identifier of the class, as well as the variable name and function name of the class according to the assignment expression node; the assignment expression node is used to define the class's own attributes.

[0102] In the embodiment of the present application, the assignment expression node is a node containing an assignment expression (AssignmentExpression), wherein the assignment expression is an expression in the source language information for assignment operation, which is composed of an assignment operator, such as "=", and two expressions located on both sides of the assignment operator. In the declaration / definition process of a class, an assignment expression node is used to initialize / define the class. For example, for source language information developed based on the GoogleClosure Library framework, efg=function(){} is an assignment expression, which can be used to initialize / define a class with a class identifier of efg.

[0103] Specifically, the assignment expression node can be determined from the syntax tree document by searching for the assignment operator in the syntax tree document, the determined assignment expression can be identified, and the class identifier of each class can be determined based on the assignment expression for initializing / defining the class.

[0104] For example, refer to Figure 2 , assuming that the content of node B is efgproperty=a, and the content of node C is efg=function(){}, then node C declares the class efg and initializes efg. The specific meaning of node B is that a variable a of class efg is declared.

[0105] After determining the class identifier of a class, the assignment expression nodes for initializing / defining the members of the class can be determined among all the above-mentioned assignment expression nodes, and the member names of the members of the class can be obtained, wherein, since the members of a class include member functions and member variables, the member names include variable names and function names.

[0106] Step 103, obtaining a call expression node from the syntax tree document, and determining the class identifiers of other classes associated with the class according to the call expression node; the call expression node is used to define the association relationship between the class and the other classes.

[0107] In an embodiment of the present application, a call expression node is a node containing a call expression (CallExpression), which is used to call a class / function. The call expression is composed of a function qualifier and a call parameter. For example, for source language information developed based on the Google Closure Library framework, goog.inherits('efg', 'e.f') is a call expression, wherein goog.inherits is a function qualifier, indicating that the call expression is used to establish an inheritance relationship between classes, efg is the first call parameter, ef is the second call parameter, and the call expression indicates that class efg inherits from class ef. It can be seen that a function call expression can be used to represent an association relationship between classes. It should be noted that a call expression can be composed of different function qualifiers, and different function qualifiers indicate that the call expression is used to define different association relationships between classes.

[0108] Specifically, after determining the class identifier of a class, determine the calling expression node from all nodes, and search for the class identifier of the class in the determined calling expression node, and determine other classes that have an association relationship with the class and the type of the association relationship based on the calling expression node containing the class identifier of the class.

[0109] Step 104: construct a visualization model of the source language information based on the class identifier, variable name, function name of the class and the class identifiers of other classes associated with the class, wherein the visualization model is used to display the variable name, function name of the class and the association relationship between classes.

[0110] After determining the class attributes of each class, such as the class identifier, variable name, function name, and class identifiers of other associated classes, the attributes of each class can be summarized to establish an attribute table containing the attributes of each class, and text description content of each attribute of each class can be generated based on the attribute table. All text description content can be input into a preset drawing tool to draw a visualization model corresponding to the source language information.

[0111] For example, for a class with a class identifier of efg, the class has a variable property, the class has a function method, and the class has an inheritance relationship with ef, then the property table can be established as shown in Table 1:

[0112] Class Identifier Variable Name Function Name Inheritance efg property method ef

[0113] Table 1

[0114] According to Table 1, text description content that meets the format requirements of the drawing tool can be constructed, and the text description content is used to pass the attribute information corresponding to each class to the drawing tool. For example, when the drawing tool is Nomnoml, the text description content "[ab|method]" suitable for the Nomonoml tool can be constructed according to the above Table 1 to indicate that a function name of the class ab is method. All attributes of all classes can be represented by a line of text description content suitable for the Nomonoml tool, and all text description content can be input into the Nomonoml tool and other drawing tools to draw a visualization model of the source language information. The visualization model can graphically display the class variable name, function name, and the relationship between classes, so that developers can intuitively understand the content of the source language information.

[0115] In summary, a language information visualization method provided by an embodiment of the present application includes: obtaining source language information, and converting the source language information into a syntax tree document, obtaining an assignment expression node from the syntax tree document, and determining the class identifier of the class, as well as the variable name and function name of the class according to the assignment expression node, obtaining a call expression node from the syntax tree document, and determining the class identifiers of other classes associated with the class according to the call expression node, and constructing a visualization model of the source language information according to the class identifier, variable name, function name, and class identifiers of other classes associated with the class. The embodiment of the present application automatically obtains the identifiers, member names, and call relationships of each class in the source language information by utilizing syntax tree document technology, and automatically draws a visualization model of the source language information, thereby reducing the labor cost and time cost of constructing a visualization model of the source language information, and avoiding the omissions and errors caused by manually constructing a visualization model of the source language information, which leads to poor visualization model effects.

[0116] Figure 3 is a flowchart of another method for visualizing language information provided by an embodiment of the present application. Figure 3 As shown, the method may include:

[0117] Step 201: Acquire a syntax tree document corresponding to source language information, wherein the syntax tree document includes a plurality of nodes forming a tree structure, and the nodes are used to represent the syntax structure of the language information segments in the source language information.

[0118] This step may specifically refer to the above step 101, which will not be described in detail here.

[0119] Step 202: Obtain the assignment expression node from the syntax tree document.

[0120] This step may specifically refer to the above step 102, which will not be described in detail here.

[0121] Step 203: Determine a first expression node whose type is a class initialization node from the assignment expression nodes, and determine a class identifier of the class from the first expression node.

[0122] In the source language information, a class is generally declared first, and then the class is initialized / defined. If a class is only declared but not initialized / defined, the class does not play a practical role in the source language information. For a class that is not initialized, there is no need to obtain its corresponding class identifier or determine its corresponding attribute information. Therefore, in an embodiment of the present application, an assignment expression node can include multiple types, such as an assignment expression node of a class initialization type, and an assignment expression node of a class initialization type is used to initialize / define a class.

[0123] After an initialization node is determined, the class identifier of the class in the initialization node may be obtained, and then the attribute information corresponding to the class may be further obtained through the following steps.

[0124] Specifically, the following method from sub-step 2031 to sub-step 2032 may be used to determine the class identifier of the class from the assignment expression node.

[0125] Optionally, step 203 may specifically include:

[0126] Sub-step 2031: Determine, as the first expression node, the assignment expression node whose assignment operator side includes a class identifier and whose other side includes a function expression.

[0127] First, traverse all assignment expression nodes and identify the expressions on both sides of the assignment operator in each assignment expression node. If the expression on the left side of the assignment operator meets the class identification rule, that is, the expression on the left side of the assignment operator is a class identifier, then continue to identify the expression on the right side of the assignment operator of the assignment expression. If the expression type on the right side of the assignment operator of the assignment expression is a function expression (Function Expression), then the assignment expression node is determined to be a class initialization node, that is, the first expression node, wherein the first expression node is an assignment expression node of the initialization node type among all assignment expression nodes.

[0128] For example, for source language information developed based on the Google Closure Library framework, for an assignment expression node containing an assignment expression "efg=function(){}", the expression "efg" on the left side of the assignment operator "=" in the assignment expression complies with the class identification rule and is a class identification, and the expression "function(){}" on the right side of the assignment operator "=" is a function expression, then the assignment expression is used to initialize / define the class "efg", and the node where the assignment expression is located is a first expression node.

[0129] Sub-step 2032: determine the class identifier contained in one side of the first expression node as the class identifier of the class.

[0130] For each first expression node determined, the class identifier can be obtained, and the corresponding attribute information can be further determined for the classes corresponding to all the obtained class identifiers, and then a visualization model corresponding to the source language information can be drawn based on the class identifiers and attribute information of the classes determined from the first expression node.

[0131] For example, for source language information developed based on the Google Closure Library framework, a corresponding first expression may be "efg=function(){}", wherein the left side of the assignment operator "=" contains a class identifier "efg", and "efg" may be determined as the class identifier of the class whose attribute information needs to be further determined.

[0132] Furthermore, for a class, if it is only initialized / defined but no member thereof is defined, the class will not have any effect in the source language information. Therefore, after obtaining the class identifier from the first expression, it is possible to further determine whether the class corresponding to the class identifier has corresponding variable names and / or function names through the methods of steps 204 to 205. If the class corresponding to the class identifier has corresponding variable names and / or function names, the class identifier of the class is recorded and the attribute information of the class is further determined. Otherwise, the class can be ignored and the class identifier of the class is not recorded.

[0133] Step 204: Determine a second expression node whose type is a member variable assignment node from the assignment expression node, and obtain the variable name of the class from the second expression node.

[0134] The assignment expression node also includes a second expression node for assigning values ​​to member variables of the class, the second expression node consists of an assignment operator, a member expression on the left side of the assignment operator, and a numerical expression on the right side of the assignment operator, wherein the type of the numerical expression may include a literal type, an identifier type, and a variable type.

[0135] For example, a second expression node corresponding to the class "efg" includes "efgproperty=a", "efgproperty" on the left side of the second expression node is a member expression, and "a" on the right side of the second expression node is a numerical expression of the variable type. The second expression node is used to assign the variable a to the property member variable of the class efg.

[0136] Specifically, it is possible to first determine whether the left side of the assignment expression node is a member expression containing a class identifier. If so, then determine whether the right side of the assignment expression node is a numerical expression. If so, determine the assignment expression node as the second expression node.

[0137] Optionally, step 204 may specifically include:

[0138] Sub-step 2041: Determine as a second expression node an assignment expression node at the same level as the first expression node, an assignment expression node whose assignment operator side contains a member expression of the class identifier of the class and whose other side contains a numerical expression; the type of the numerical expression is any one of a literal type, an identifier type and a variable type.

[0139] In a syntax tree document, due to the restrictions of syntax tree document rules, for any class, the second expression node of the class is generally located in an assignment expression node at the same level as the first expression node of the class. Since the first expression node is an initialization node, the second expression node of the class is generally located in an assignment expression node at the same level as the first expression node of the class.

[0140] Therefore, for any class, you can first determine the assignment expression node at the same level as the first expression node of the class from the syntax tree, and then determine the second expression node from the assignment expression node at the same level as the first expression node of the class, so as to narrow the scope of the second expression node corresponding to the search class and improve query efficiency.

[0141] Specifically, in an assignment expression node at the same level as the first expression node, an assignment expression node whose assignment operator side includes a member expression of a class identifier of a class and whose other side includes a numerical expression can be determined as the second expression node.

[0142] Sub-step 2042: determine the variable identifier in the member expression of the second expression node as the variable name corresponding to the class.

[0143] In the second expression node, the member expression on the left side of the assignment operator includes the class identifier and the variable identifier of a member variable corresponding to the class identifier. For example, for source language information developed based on the Google Closure Library framework, the corresponding second expression can be "efgproperty=a", where the left side of the assignment operator "=" contains a member expression "efgproperty", and the "property" in the member expression is the variable identifier of a member variable of the class "efg".

[0144] Specifically, after determining the second expression node of a class, the variable identifier in the second expression node of the class can be used as a variable name of the class.

[0145] Optionally, sub-step 2042 may specifically include:

[0146] Sub-step A1: when the member expression of the second expression node includes a prototype indication mark, determine the variable identifier in the member expression of the second expression node as the prototype variable name of the class.

[0147] Since the member variables of a class include prototype member variables and static member variables, the variable names need to be distinguished when determining the variable name of a class.

[0148] A prototype indicator may also be included in the member expression of the second expression node. The prototype indicator in the second expression node is used to indicate the type of the member variable in the member expression. If a prototype indicator exists in a second expression node, the member variable in the second expression node is a prototype member variable. For example, for source language information developed based on the Google Closure Library framework, a corresponding second expression may be "efgprototype.property=a", where prototype is the prototype indicator, and the member variable prototype in the second expression is a prototype member variable. It should be noted that the specific expression of the prototype indicator may be different in different frameworks, and the technician can distinguish and set the prototype indicator that needs to be matched according to the development framework based on the source language information.

[0149] Specifically, after determining the second expression node of the class, it can be further determined whether there is a prototype indication mark in the second expression node. If so, the variable identifier in the member expression in the second expression node is determined as a prototype variable name of the class.

[0150] Sub-step A2: when the member expression of the second expression node does not include the prototype indication mark, determine the variable identifier in the member expression of the second expression node as the static variable name of the class.

[0151] If a prototype indicator does not exist in a second expression node, the member variable in the second expression node is a static member variable. For example, for source language information developed based on the Google Closure Library framework, a corresponding second expression may be "efgproperty=a", which does not contain a prototype indicator, and the member variable prototype in the second expression is a static member variable.

[0152] Specifically, after determining the second expression node of the class, it can be further determined whether there is a prototype indicator in the second expression node. If not, the variable identifier in the member expression in the second expression node is determined as a static variable name of the class.

[0153] Step 205: Determine a third expression node whose type is a member function assignment node from the assignment expression nodes, and obtain the function name of the class from the third expression node.

[0154] The assignment expression node also includes a third expression node for assigning a member function of the class, the third expression node consisting of an assignment operator, a member expression on the left side of the assignment operator, and a function expression on the right side of the assignment operator.

[0155] For example, a third expression node corresponding to the class "efg" includes "efgproperty=function(){}", the "efgproperty" on the left side of the third expression node is a member expression, and the "function(){}" on the right side of the third expression node is a function expression. The third expression node is used to assign the function function(){} to the property member function of the class efg.

[0156] Specifically, it is possible to first determine whether the left side of the assignment expression node is a member expression containing a class identifier. If so, then determine whether the right side of the assignment expression node is a function expression. If so, determine the assignment expression node as the third expression node.

[0157] Optionally, step 205 may specifically include:

[0158] Sub-step 2051: Determine as a third expression node an assignment expression node at the same level as the first expression node, the assignment expression node having a member expression of the class identifier of the class on one side of the assignment operator and a function expression on the other side.

[0159] In a syntax tree document, due to the restrictions of syntax tree document rules, for any class, the third expression node of the class is located in an assignment expression node at the same level as the initialization node of the class. Since the first expression node is an initialization node, the third expression node of the class is located in an assignment expression node at the same level as the initialization node of the class.

[0160] Therefore, for any class, you can first determine the assignment expression node at the same level as the first expression node of the class from the syntax tree, and then determine the third expression node from the assignment expression node at the same level as the first expression node of the class, so as to narrow the scope of the third expression node corresponding to the search class and improve query efficiency.

[0161] Specifically, in an assignment expression node at the same level as the first expression node, the assignment expression node whose left side of the assignment operator contains a member expression of the class identifier of the class and whose right side contains a function expression can be determined as the third expression node.

[0162] Sub-step 2052: determine the function identifier in the member expression of the third expression node as the function name of the class.

[0163] In the third expression node, the member expression on the left side of the assignment operator includes the class identifier and the function identifier of a member function corresponding to the class identifier. For example, for source language information developed based on the Google Closure Library framework, the corresponding third expression can be "efgproperty=function(){}", where the left side of the assignment operator "=" contains a member expression "efgproperty", and the "property" in the member expression is the function identifier of a member function of the class "efg".

[0164] Specifically, after determining the third expression node of a class, the function identifier in the third expression node of the class can be used as a function name of the class.

[0165] Optionally, sub-step 2052 may specifically include:

[0166] Sub-step B1: when the member expression of the third expression node includes a prototype indication mark, determine the function identifier in the member expression of the third expression node as the prototype function name of the class.

[0167] Since the member functions of a class include prototype member functions and static member functions, the function names need to be distinguished when determining the function name of a class.

[0168] In the member expression of the third expression node, a prototype indication mark may also be included. The prototype indication mark in the third expression node is used to indicate the type of the member function in the member expression. If a prototype indication mark exists in a third expression node, the member function in the third expression node is a prototype member function. For example, for source language information developed based on the Google Closure Library framework, a corresponding third expression may be "efgprototype.property=function(){}", where prototype is the prototype indication mark, and the member function prototype in the third expression is a prototype member function. It should be noted that in different frameworks, the specific expression form of the prototype indication mark may be different, and the technician can distinguish and set the prototype indication mark that needs to be matched according to the development framework based on the source language information.

[0169] Specifically, after determining the third expression node of the class, it can be further determined whether there is a prototype indication mark in the third expression node. If so, the function identifier in the member expression in the third expression node is determined as a prototype function name of the class.

[0170] Sub-step B2: when the member expression of the third expression node does not include the prototype indication mark, determine the function identifier in the member expression of the third expression node as the static function name of the class.

[0171] If a prototype indicator does not exist in a third expression node, the member function in the third expression node is a static member function. For example, for source language information developed based on the Google Closure Library framework, a corresponding third expression may be "efgproperty = function () {}", which does not contain a prototype indicator, and the member function prototype in the third expression is a static member function.

[0172] Specifically, after determining the third expression node of the class, it can be further determined whether there is a prototype indicator in the third expression node. If not, the function identifier in the member expression in the third expression node is determined as a static function name of the class.

[0173] Step 206: Obtain a call expression node from the syntax tree document, and determine class identifiers of other classes associated with the class according to the call expression node.

[0174] This step may specifically refer to the above step 103, which will not be described in detail here.

[0175] Optionally, step 206 may specifically include:

[0176] Sub-step 2061: Determine the node containing the function call identifier in the syntax tree document as the call expression node.

[0177] A call expression consists of a function qualifier and a call parameter. For example, for source language information developed based on the Google ClosureLibrary framework, goog.inherits('efg','e.f') is a call expression, where goog.inherits is a function qualifier, indicating that the call expression is used to establish an inheritance relationship between classes, efg is the first call parameter, and ef is the second call parameter. The call expression indicates that class efg inherits from class ef.

[0178] Specifically, all nodes can be traversed, and functional qualifiers can be matched in the nodes, and nodes with functional qualifiers can be determined as call expression nodes. Among them, functional qualifiers can include functional qualifiers that indicate inheritance relationships between classes. For example, for source language information developed based on the Google Closure Library framework, goog.inherits is a functional qualifier that indicates inheritance relationships between classes. Functional qualifiers can also include functional qualifiers that declare external dependency classes. For example, for source language information developed based on the Google Closure Library framework, goog.require is a functional qualifier that declares external dependency classes. When a class is declared as an external dependency class, all classes that are not external dependency classes have a dependency relationship with the external dependency class.

[0179] Sub-step 2062: when the number of function parameters of the call expression node is equal to one, determine the first parameter of the function parameters in the call expression node as the class identifier of the dependent class of the class.

[0180] After obtaining the call expression node, the class identifier in the function parameter of the call expression node that declares the external dependency class can be used as the functional qualifier, and the corresponding class can be determined as the dependent class to indicate that all non-external dependent classes are dependent on the class corresponding to the class identifier.

[0181] Since different types of call expression nodes have different numbers of function parameter items, different types of call expression nodes can also be distinguished by the number of function parameter items.

[0182] Specifically, when the number of function parameters of a call expression node is equal to one item, the call expression node is used to declare an external dependency class, and the class identifier in the function parameter in the call expression node can be determined as the class identifier of the dependent class of all non-external dependency classes.

[0183] Sub-step 2063: When the number of function parameters in the call expression node is equal to or greater than two, and the second parameter of the function parameter in the call expression node matches the class identifier of the class, the first parameter of the function parameter in the call expression node is determined as the class identifier of the inherited class of the class.

[0184] When the number of function parameters of a call expression node is equal to or greater than two, the call expression node is used to indicate the inheritance relationship of the class. For example, for source language information developed based on the Google Closure Library framework, goog.inherits('efg', 'e.f') in the call expression node is used to indicate that class efg inherits from class ef. If it is determined that the number of function parameters of a call expression node is equal to or greater than two, the class identifier in the first parameter of the function parameter in the call expression node can be further used as the inheritance class of the class identifier in the second parameter of the function parameter to indicate that there is an inheritance relationship between the class corresponding to the class identifier in the first parameter and the class corresponding to the class identifier in the second parameter.

[0185] It should be noted that in the source language information developed based on the Google Closure Library framework, the function parameters of the call expression used to represent the inheritance relationship between classes are two, but for some other language frameworks, the function parameters of the call expression used to represent the inheritance relationship between classes may be greater than two. Therefore, when determining the inheritance relationship between classes from the call expression, you can choose the appropriate judgment rule according to the grammatical rules of different language frameworks.

[0186] Step 207: When the class belongs to a parent class, obtain all second expression nodes and all third expression nodes of the class; the second expression nodes are used to define variables of the class, and the third expression nodes are used to define functions of the class.

[0187] When a class is inherited by other classes, it is the parent class of other classes and belongs to the parent class. When a class belongs to the parent class, if all the corresponding members of the class are null values, the class is also an interface implementation class.

[0188] Specifically, for a class that is a parent class, all of its second expression nodes and all of its third expression nodes can be obtained. Since the second expression node is a node used to define the member variables of the class, and the third expression node is a node used to define the function variables of the class, it is possible to determine whether the class is an interface implementation class based on the second expression node and the third expression node of the class.

[0189] Step 208: When the function expressions of all the third expression nodes are null values ​​and the numerical expressions of all the second expression nodes are null values, determine that the type of the class is an interface implementation class.

[0190] If a class that is a parent class has all its corresponding third expression function expressions that are null values, and all its corresponding second expression numerical expressions that are also null values, then it means that all members of the class that is the parent class are null values. At this time, the type of the class can be determined as an interface implementation class.

[0191] Step 209: construct an attribute string of the class according to the class identifier, variable name, function name, and class identifiers and types of other associated classes of the class.

[0192] The class identifiers of other associated classes may include the class identifiers of inherited classes and the class identifiers of dependent classes.

[0193] For example, for a class efg, the class identifier of the class is efg, a variable name of the class is property, a function name is method, a class identifier of an inherited class is jc, and a class identifier of a dependent class is yl, then the constructed attribute string includes: "[efg|method]", indicating that a function name of the class efg is method; "[efg|property]", indicating that a variable name of the class efg is property; "[efg<--jc]", indicating that the class efg is inherited by the class jc; "[efg<-yl]", indicating that the class efg is dependent on the class yl; "[efg--:>interface]", indicating that the property of the class efg is the interface implementation class. The above attribute string is a fixed format when using the Nomnoml drawing tool. When using other drawing tools, the format of the attribute string can be different.

[0194] Step 210: Input the attribute character strings of each class into a drawing tool to obtain the visualization model.

[0195] After obtaining the attribute strings of each class, the attribute strings may be input into a drawing tool so that the drawing tool draws a source language information visualization model according to the attribute strings.

[0196] See also Figure 4 , shows a schematic diagram of a source language information visualization model provided by an embodiment of the present application. For example, the attribute string in the above example can be input into the Nomnoml drawing tool to obtain the following Figure 4 The source language information visualization model diagram shown, wherein the rectangular box 1 is the class identifier of the class; the rectangular box 2 is the attribute of the class, when the rectangular box 2 contains interface, it indicates that the class corresponding to the class identifier efg in the connected rectangular box 1 is the interface implementation type; the rectangular box 3 is the function name of the class efg; the rectangular box 4 is the variable name of the class efg. It should be noted that the embodiment of the present application does not specifically limit the specific form of expression of the final visualization model diagram.

[0197] In summary, a language information visualization method provided by an embodiment of the present application includes: obtaining source language information, and converting the source language information into a syntax tree document, obtaining an assignment expression node from the syntax tree document, and determining the class identifier of the class, as well as the variable name and function name of the class according to the assignment expression node, obtaining a call expression node from the syntax tree document, and determining the class identifiers of other classes associated with the class according to the call expression node, and constructing a visualization model of the source language information according to the class identifier, variable name, function name, and class identifiers of other classes associated with the class. The embodiment of the present application automatically obtains the identifiers, member names, and call relationships of each class in the source language information by utilizing syntax tree document technology, and automatically draws a visualization model of the source language information, thereby reducing the labor cost and time cost of constructing a visualization model of the source language information, and avoiding the omissions and errors caused by manually constructing a visualization model of the source language information, which leads to poor visualization model effects.

[0198] Figure 5 is a block diagram of a language information visualization device provided in an embodiment of the present application, such as Figure 5 As shown, it includes: a grammar acquisition module 301, a member determination module 302, a function determination module 303, and a construction module 304.

[0199] The grammar acquisition module 301 is configured to acquire a grammar tree document corresponding to the source language information, wherein the grammar tree document includes a plurality of nodes forming a tree structure, wherein the nodes are used to represent the grammar structure of the language information fragment in the source language information;

[0200] The member determination module 302 is configured to obtain an assignment expression node from the syntax tree document, and determine the class identifier of the class, and the variable name and function name of the class according to the assignment expression node; the assignment expression node is used to define the class's own attributes;

[0201] The function determination module 303 is configured to obtain a call expression node from the syntax tree document, and determine the class identifier of other classes associated with the class according to the call expression node; the call expression node is used to define the association relationship between the class and the other classes;

[0202] The construction module 304 is configured to construct a visualization model of the source language information based on the class identifier, variable name, function name of the class and the class identifiers of other classes associated with the class, and the visualization model is used to display the variable name, function name of the class and the association relationship between classes.

[0203] In an optional implementation, it is characterized in that the member determination module includes:

[0204] An acquisition submodule, configured to acquire the assignment expression node from the syntax tree document;

[0205] A class identification submodule is configured to determine a first expression node of a class initialization node type from the assignment expression nodes, and determine a class identification of the class from the first expression node;

[0206] A variable name submodule is configured to determine a second expression node of a member variable assignment node type from the assignment expression node, and obtain the variable name of the class from the second expression node;

[0207] The function name submodule is configured to determine a third expression node whose type is a member function assignment node from the assignment expression node, and obtain the function name of the class from the third expression node.

[0208] In an optional implementation, it is characterized in that the class identification submodule includes:

[0209] A first expression submodule is configured to determine, in the assignment expression node, an assignment expression node whose assignment operator side includes a class identifier and whose other side includes a function expression as the first expression node;

[0210] The class identifier determination submodule is configured to determine the class identifier contained in one side of the first expression node as the class identifier of the class.

[0211] In an optional implementation, it is characterized in that the variable name submodule includes:

[0212] A second expression submodule is configured to determine, as a second expression node, an assignment expression node at the same level as the first expression node, an assignment expression node whose one side of the assignment operator contains a member expression of the class identifier of the class and whose other side contains a numerical expression; the type of the numerical expression is any one of a literal type, an identifier type and a variable type;

[0213] The variable name determination submodule is configured to determine the variable identifier in the member expression of the second expression node as the variable name corresponding to the class.

[0214] In an optional implementation, it is characterized in that the variable name includes a prototype variable name and a static variable name, and the variable name determination submodule includes:

[0215] A prototype variable name submodule is configured to determine the variable identifier in the member expression of the second expression node as the prototype variable name of the class when the member expression of the second expression node includes a prototype indication mark;

[0216] The static variable name submodule is configured to determine the variable identifier in the member expression of the second expression node as the static variable name of the class when the member expression of the second expression node does not include the prototype indication mark.

[0217] In an optional implementation, it is characterized in that the function name submodule includes:

[0218] A third expression submodule is configured to determine, as a third expression node, an assignment expression node at the same level as the first expression node, an assignment expression node whose assignment operator side includes a member expression of the class identifier of the class and whose other side includes a function expression;

[0219] The function name determination submodule is configured to determine the function identifier in the member expression of the third expression node as the function name of the class.

[0220] In an optional implementation, it is characterized in that the function name includes a prototype function name and a static function name, and the function name determination submodule includes:

[0221] A prototype function name submodule is configured to determine the function identifier in the member expression of the third expression node as the prototype function name of the class when the member expression of the third expression node includes a prototype indication mark;

[0222] The static function name submodule is configured to determine the function identifier in the member expression of the third expression node as the static function name of the class when the member expression of the third expression node does not include the prototype indication mark.

[0223] In an optional implementation, it is characterized in that the other classes associated with the class include inherited classes and dependent classes associated with the class, and the function determination module includes:

[0224] A call expression submodule is configured to determine a node in the syntax tree document that contains a function call identifier as the call expression node;

[0225] The dependent class submodule is configured to determine the first parameter of the function parameter in the calling expression node as the class identifier of the dependent class of the class when the number of items of the function parameter of the calling expression node is equal to one item;

[0226] The inheritance class submodule is configured to determine the first parameter of the function parameter in the call expression node as the class identifier of the inheritance class of the class when the number of items of the function parameter of the call expression node is equal to or greater than two and the second parameter of the function parameter in the call expression node matches the class identifier of the class.

[0227] In an optional embodiment, it is characterized in that the device further comprises:

[0228] An expression acquisition module, configured to acquire all second expression nodes and all third expression nodes of the class when the class belongs to a parent class; the second expression nodes are used to define variables of the class, and the third expression nodes are used to define functions of the class;

[0229] The interface implementation class module is configured to determine that the type of the class is an interface implementation class when the function expressions of all the third expression nodes are null values ​​and the numerical expressions of all the second expression nodes are null values.

[0230] In an optional implementation, it is characterized in that the building module includes:

[0231] A string submodule is configured to construct an attribute string of the class according to the class identifier, variable name, function name, class identifiers and types of other associated classes of the class;

[0232] A submodule is constructed, and the attribute strings of each class are input into a drawing tool to obtain the visualization model.

[0233] In summary, a language information visualization device provided by an embodiment of the present application includes: obtaining source language information, and converting the source language information into a syntax tree document, obtaining an assignment expression node from the syntax tree document, and determining the class identifier of the class, as well as the variable name and function name of the class according to the assignment expression node, obtaining a call expression node from the syntax tree document, and determining the class identifiers of other classes associated with the class according to the call expression node, and constructing a visualization model of the source language information according to the class identifier, variable name, function name, and class identifiers of other classes associated with the class. The embodiment of the present application automatically obtains the identifiers, member names, and call relationships of each class in the source language information by utilizing syntax tree document technology, and automatically draws a visualization model of the source language information, thereby reducing the labor cost and time cost of constructing a visualization model of the source language information, and avoiding the omissions and errors caused by manually constructing a visualization model of the source language information, which leads to poor visualization model effects.

[0234] Figure 6is a block diagram of an electronic device 600 according to an exemplary embodiment. For example, the electronic device 600 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0235] Reference Figure 6 , the electronic device 600 may include one or more of the following components: a processing component 602 , a memory 604 , a power component 606 , a multimedia component 608 , an audio component 610 , an input / output (I / O) interface 612 , a sensor component 614 , and a communication component 616 .

[0236] The processing component 602 generally controls the overall operation of the electronic device 600, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 602 may include one or more processors 620 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 602 may include one or more modules to facilitate the interaction between the processing component 602 and other components. For example, the processing component 602 may include a multimedia module to facilitate the interaction between the multimedia component 608 and the processing component 602.

[0237] The memory 604 is used to store various types of data to support the operation of the electronic device 600. Examples of such data include instructions for any application or method operating on the electronic device 600, contact data, phone book data, messages, pictures, multimedia, etc. The memory 604 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0238] The power supply component 606 provides power to the various components of the electronic device 600. The power supply component 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 600.

[0239] The multimedia component 608 includes a screen that provides an output interface between the electronic device 600 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 608 includes a front camera and / or a rear camera. When the electronic device 600 is in an operating mode, such as a shooting mode or a multimedia mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0240] The audio component 610 is used to output and / or input audio signals. For example, the audio component 610 includes a microphone (MIC), and when the electronic device 600 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is used to receive an external audio signal. The received audio signal can be further stored in the memory 604 or sent via the communication component 616. In some embodiments, the audio component 610 also includes a speaker for outputting audio signals.

[0241] I / O interface 612 provides an interface between processing component 602 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0242] The sensor assembly 614 includes one or more sensors for providing various aspects of status assessment for the electronic device 600. For example, the sensor assembly 614 can detect the open / closed state of the electronic device 600, the relative positioning of the components, such as the display and keypad of the electronic device 600, and the sensor assembly 614 can also detect the position change of the electronic device 600 or a component of the electronic device 600, the presence or absence of contact between the user and the electronic device 600, the orientation or acceleration / deceleration of the electronic device 600, and the temperature change of the electronic device 600. The sensor assembly 614 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 614 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 614 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0243] The communication component 616 is used to facilitate wired or wireless communication between the electronic device 600 and other devices. The electronic device 600 can access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 616 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 616 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0244] In an exemplary embodiment, the electronic device 600 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to implement a language information visualization method provided in an embodiment of the present application.

[0245] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 604 including instructions, and the instructions can be executed by a processor 620 of an electronic device 600 to perform the above method. For example, the non-transitory storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0246] Figure 7 is a block diagram of an electronic device 700 according to an exemplary embodiment. For example, the electronic device 700 may be provided as a server. Figure 7 The electronic device 700 includes a processing component 722, which further includes one or more processors, and a memory resource represented by a memory 732 for storing instructions executable by the processing component 722, such as an application. The application stored in the memory 732 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 722 is configured to execute instructions to perform a language information visualization method provided in an embodiment of the present application.

[0247] The electronic device 700 may also include a power supply component 726 configured to perform power management of the electronic device 700, a wired or wireless network interface 750 configured to connect the electronic device 700 to a network, and an input / output (I / O) interface 758. The electronic device 700 may operate based on an operating system stored in the memory 732, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™ or the like.

[0248] An embodiment of the present application also provides a computer program product, including a computer program, which implements the language information visualization method when executed by a processor.

[0249] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the application disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0250] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A language information visualization method, characterized in that: The method comprises: Acquire a syntax tree document corresponding to the source language information, wherein the syntax tree document includes a plurality of nodes forming a tree structure, and the nodes are used to represent the syntax structure of the language information fragment in the source language information; Obtaining an assignment expression node from the syntax tree document, and determining a class identifier of a class, and a variable name and a function name of the class according to the assignment expression node; the assignment expression node is used to define the class's own attributes; Acquire a call expression node from the syntax tree document, and determine class identifiers of other classes associated with the class according to the call expression node; the call expression node is used to define the association relationship between the class and the other classes; A visualization model of the source language information is constructed based on the class identifier, variable name, function name of the class and the class identifiers of other classes associated with the class. The visualization model is used to display the variable name, function name of the class and the association relationship between classes.

2. The method according to claim 1, characterized in that The step of obtaining an assignment expression node from the syntax tree document, and determining a class identifier of a class, and a variable name and a function name of the class according to the assignment expression node; The assignment expression node is used to define the class's own attributes, including: Obtain the assignment expression node from the syntax tree document; Determine a first expression node of a class initialization node type from the assignment expression nodes, and determine a class identifier of the class from the first expression node; Determine a second expression node whose type is a member variable assignment node from the assignment expression node, and obtain the variable name of the class from the second expression node; A third expression node whose type is a member function assignment node is determined from the assignment expression nodes, and the function name of the class is obtained from the third expression node.

3. The method according to claim 2, characterized in that The step of determining a first expression node whose type is a class initialization node from the assignment expression node, and determining a class identifier of the class from the first expression node, comprises: Determine, in the assignment expression node, an assignment expression node including a class identifier on one side of an assignment operator and a function expression on the other side as the first expression node; The class identifier contained in one side of the first expression node is determined as the class identifier of the class.

4. The method according to claim 2, characterized in that: The step of determining a second expression node whose type is a member variable assignment node from the assignment expression node, and obtaining the variable name of the class from the second expression node, comprises: Determine, as a second expression node, an assignment expression node at the same level as the first expression node, an assignment expression node whose assignment operator includes a member expression of the class identifier of the class on one side and a numerical expression on the other side; the type of the numerical expression is any one of a literal type, an identifier type and a variable type; The variable identifier in the member expression of the second expression node is determined as the variable name corresponding to the class.

5. The method according to claim 4, characterized in that The variable name includes a prototype variable name and a static variable name, and the step of determining the variable identifier in the member expression of the second expression node as the variable name corresponding to the class includes: In the case where the member expression of the second expression node includes a prototype indication mark, determining the variable identifier in the member expression of the second expression node as the prototype variable name of the class; When the prototype indication mark is not included in the member expression of the second expression node, the variable identifier in the member expression of the second expression node is determined as the static variable name of the class.

6. The method according to claim 2, characterized in that The step of determining a third expression node whose type is a member function assignment node from the assignment expression node, and obtaining the function name of the class from the third expression node, comprises: Determine, as a third expression node, an assignment expression node at the same level as the first expression node, an assignment expression node whose assignment operator side includes a member expression of the class identifier of the class and whose other side includes a function expression; The function identifier in the member expression of the third expression node is determined as the function name of the class.

7. The method according to claim 6, characterized in that The function name includes a prototype function name and a static function name, and determining the function identifier in the member expression of the third expression node as the function name of the class includes: In the case where the member expression of the third expression node includes a prototype indication mark, determining the function identifier in the member expression of the third expression node as the prototype function name of the class; In a case where the member expression of the third expression node does not include the prototype indication mark, the function identifier in the member expression of the third expression node is determined as the static function name of the class.

8. The method according to claim 1, characterized in that The other classes associated with the class include inherited classes and dependent classes associated with the class, and obtaining a call expression node from the syntax tree document and determining class identifiers of other classes associated with the class according to the call expression node include: Determine a node in the syntax tree document that contains a function call identifier as the call expression node; In the case that the number of items of the function parameters of the call expression node is equal to one item, determining the first item parameter of the function parameters in the call expression node as the class identifier of the dependent class of the class; When the number of function parameters in the call expression node is equal to or greater than two, and the second parameter of the function parameters in the call expression node matches the class identifier of the class, the first parameter of the function parameters in the call expression node is determined as the class identifier of the inherited class of the class.

9. The method according to claim 1, characterized in that: The method further comprises: In the case where the class belongs to a parent class, all second expression nodes and all third expression nodes of the class are obtained; the second expression nodes are used to define variables of the class, and the third expression nodes are used to define functions of the class; When the function expressions of all the third expression nodes are null values, and the numerical expressions of all the second expression nodes are null values, the type of the class is determined to be an interface implementation class.

10. The method according to claim 9, characterized in that The step of constructing a visualization model of the source language information according to the class identifier, variable name, function name of the class and class identifiers of other classes associated with the class includes: Constructing an attribute string of the class according to the class identifier, variable name, function name, class identifiers and types of other associated classes of the class; The attribute character strings of each class are input into a drawing tool to obtain the visualization model.

11. A language information visualization device, characterized in that: The device comprises: A grammar acquisition module is configured to acquire a grammar tree document corresponding to the source language information, wherein the grammar tree document includes a plurality of nodes forming a tree structure, and the nodes are used to represent the grammar structure of the language information segment in the source language information; A member determination module is configured to obtain an assignment expression node from the syntax tree document, and determine a class identifier of a class, and a variable name and a function name of the class according to the assignment expression node; the assignment expression node is used to define the class's own attributes; A function determination module is configured to obtain a call expression node from the syntax tree document, and determine the class identifier of other classes associated with the class according to the call expression node; the call expression node is used to define the association relationship between the class and the other classes; The construction module is configured to construct a visualization model of the source language information according to the class identifier, variable name, function name of the class and the class identifiers of other classes associated with the class, and the visualization model is used to display the variable name, function name of the class and the association relationship between classes.

12. The device according to claim 11, characterized in that The member determination module comprises: An acquisition submodule, configured to acquire the assignment expression node from the syntax tree document; A class identification submodule is configured to determine a first expression node of a class initialization node type from the assignment expression nodes, and determine a class identification of the class from the first expression node; A variable name submodule is configured to determine a second expression node of a member variable assignment node type from the assignment expression node, and obtain the variable name of the class from the second expression node; The function name submodule is configured to determine a third expression node whose type is a member function assignment node from the assignment expression node, and obtain the function name of the class from the third expression node.

13. The device according to claim 12, characterized in that The class identification submodule includes: A first expression submodule is configured to determine, in the assignment expression node, an assignment expression node whose assignment operator side includes a class identifier and whose other side includes a function expression as the first expression node; The class identifier determination submodule is configured to determine the class identifier contained in one side of the first expression node as the class identifier of the class.

14. The device according to claim 12, characterized in that The variable name submodule includes: A second expression submodule is configured to determine, as a second expression node, an assignment expression node at the same level as the first expression node, an assignment expression node whose one side of the assignment operator contains a member expression of the class identifier of the class and whose other side contains a numerical expression; the type of the numerical expression is any one of a literal type, an identifier type and a variable type; The variable name determination submodule is configured to determine the variable identifier in the member expression of the second expression node as the variable name corresponding to the class.

15. The device according to claim 14, characterized in that The variable names include prototype variable names and static variable names, and the variable name determination submodule includes: A prototype variable name submodule is configured to determine the variable identifier in the member expression of the second expression node as the prototype variable name of the class when the member expression of the second expression node includes a prototype indication mark; The static variable name submodule is configured to determine the variable identifier in the member expression of the second expression node as the static variable name of the class when the member expression of the second expression node does not include the prototype indication mark.

16. The device according to claim 12, characterized in that The function name submodule includes: A third expression submodule is configured to determine, as a third expression node, an assignment expression node at the same level as the first expression node, an assignment expression node whose assignment operator side includes a member expression of the class identifier of the class and whose other side includes a function expression; The function name determination submodule is configured to determine the function identifier in the member expression of the third expression node as the function name of the class.

17. The device according to claim 16, characterized in that The function name includes a prototype function name and a static function name, and the function name determination submodule includes: A prototype function name submodule is configured to determine the function identifier in the member expression of the third expression node as the prototype function name of the class when the member expression of the third expression node includes a prototype indication mark; The static function name submodule is configured to determine the function identifier in the member expression of the third expression node as the static function name of the class when the member expression of the third expression node does not include the prototype indication mark.

18. The device according to claim 11, characterized in that The other classes associated with the class include inherited classes and dependent classes associated with the class, and the function determination module includes: A call expression submodule is configured to determine a node in the syntax tree document that contains a function call identifier as the call expression node; The dependent class submodule is configured to determine the first parameter of the function parameter in the calling expression node as the class identifier of the dependent class of the class when the number of items of the function parameter of the calling expression node is equal to one item; The inheritance class submodule is configured to determine the first parameter of the function parameter in the call expression node as the class identifier of the inheritance class of the class when the number of items of the function parameter of the call expression node is equal to or greater than two and the second parameter of the function parameter in the call expression node matches the class identifier of the class.

19. The device according to claim 11, characterized in that The device also includes: An expression acquisition module, configured to acquire all second expression nodes and all third expression nodes of the class when the class belongs to a parent class; the second expression nodes are used to define variables of the class, and the third expression nodes are used to define functions of the class; The interface implementation class module is configured to determine that the type of the class is an interface implementation class when the function expressions of all the third expression nodes are null values ​​and the numerical expressions of all the second expression nodes are null values.

20. The device according to claim 19, characterized in that The building blocks include: A string submodule is configured to construct an attribute string of the class according to the class identifier, variable name, function name, class identifiers and types of other associated classes of the class; A submodule is constructed, and the attribute strings of each class are input into a drawing tool to obtain the visualization model.

21. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the method according to any one of claims 1 to 10.

22. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the method as claimed in any one of claims 1 to 10.

23. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.