Data processing method, device, equipment and storage medium

By using an abstract syntax tree to replace the target parameter with a parameter value acquisition function in parameterized calculation, the problem of low efficiency of parameterized calculation in the existing technology is solved, and more efficient parameter value acquisition and calculation are achieved.

CN114741085BActive Publication Date: 2025-09-12阿里巴巴(中国)网络技术有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210278198.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-21
Publication Date
2025-09-12
Estimated Expiration
2042-03-21

AI Technical Summary

Technical Problem

In the parameterized calculation process in the prior art, the parameter values ​​of all parameters are pre-calculated regardless of whether they affect the calculation results, resulting in low efficiency.

Method used

By obtaining the initial abstract syntax tree of the source program code, determining the referenced target parameter position, and replacing it with a parameter value acquisition function to form a replaced abstract syntax tree, the parameter value of the target parameter is obtained only when running to the parameter value acquisition function position.

Benefits of technology

The efficiency of parameterized calculations is improved, invalid parameter value acquisition operations are reduced, and calculation speed is increased.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114741085B_ABST
    Figure CN114741085B_ABST
Patent Text Reader

Abstract

The embodiments of the present application provide a data processing method, apparatus, device and storage medium. The data processing method includes: obtaining an initial abstract syntax tree corresponding to a source program code; the source program code contains a parameter reference relationship; in the initial abstract syntax tree, determining the target position information of the referenced target parameter; according to the target position information, replacing the target parameter in the initial abstract syntax tree with a parameter value acquisition function to obtain a replaced abstract syntax tree; wherein, when the parameter value acquisition function is called, it is used to run the target program code corresponding to the target parameter to obtain the parameter value of the target parameter; performing code conversion on the replaced abstract syntax tree to obtain the replaced program code and run it. The embodiments of the present application can improve the efficiency of parameterized calculations.
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 data processing method, apparatus, device, and storage medium. Background Art

[0002] Parametric calculation is involved in many application scenarios. Parametric calculation refers to the process of using a certain formula to calculate based on the values ​​of one or several parameters to obtain the calculation results.

[0003] The parameterized calculation process is typically achieved by running the corresponding program code. In related technologies, program code is typically implemented based on parameter references. The specific execution process involves first obtaining the parameter values ​​of all referenced parameters in the program code, then inserting the specific parameter values ​​into the parameter reference locations, and performing calculations based on the logical relationships (formulas) between the parameters defined in the code to obtain the final parameterized result.

[0004] The parameters used for parameterized calculations in the code usually need to rely on other parameters to perform certain operations before their values ​​can be obtained; and in some cases, due to the limitations of different logical relationships, not all parameter values ​​will affect the calculation results, or in other words, not all parameters will ultimately participate in the calculation. For example, Figure 1 For an exemplary program code used for performing parameterized calculations in the related art, see Figure 1 The left part of the program code consists of two parts: logical relationship and parameters. a, b, c and d are all parameters. According to the processing method of the relevant technology, the parameter values ​​of a, b, c and d need to be obtained together to form a complete program code (see Figure 1 The parametric calculation results can only be obtained by running the code (the right side of the code). However, analyzing its logical relationship shows that when the value of a is less than or equal to 10, no matter what the values ​​of b, c, and d are, they will not affect the code execution result (the result is 0). The parametric calculation process of the above-mentioned related art requires precalculating the parameter values ​​of all parameters regardless of whether there are parameters that do not affect the calculation results. Therefore, the parametric calculation efficiency is low. Summary of the Invention

[0005] In view of this, embodiments of the present application provide a data processing method, apparatus, device, and storage medium to at least partially solve the above-mentioned problems.

[0006] According to a first aspect of an embodiment of the present application, a data processing method is provided, including:

[0007] Obtaining an initial abstract syntax tree corresponding to a source program code; the source program code includes a parameter reference relationship;

[0008] Determining target position information of a referenced target parameter in the initial abstract syntax tree;

[0009] According to the target position information, the target parameter in the initial abstract syntax tree is replaced with a parameter value acquisition function to obtain a replaced abstract syntax tree; wherein, when the parameter value acquisition function is called, it is used to run the target program code corresponding to the target parameter to obtain the parameter value of the target parameter;

[0010] The replaced abstract syntax tree is subjected to code conversion to obtain replaced program code and run the replaced program code.

[0011] According to a second aspect of an embodiment of the present application, another data processing method is provided, which is applied to a client device, including:

[0012] Display the target component in the device display interface;

[0013] In response to a property value adjustment operation on a target property of the target component, determining a dependent property that depends on the target property;

[0014] Loading the replaced program code corresponding to the dependency property; wherein the replaced program code is program code obtained by replacing the target parameter referenced in the source program code with a parameter value acquisition function; when the parameter value acquisition function is called, the target program code corresponding to the target parameter is executed to acquire the parameter value of the target parameter; the source program code is used to acquire the property value of the dependency property; the target parameter includes the parameter corresponding to the target property;

[0015] The replaced program code is run to obtain the updated property value of the dependent property.

[0016] According to a third aspect of an embodiment of the present application, there is provided a data processing device, including:

[0017] An initial abstract syntax tree acquisition module is used to obtain an initial abstract syntax tree corresponding to a source program code; the source program code includes a parameter reference relationship;

[0018] a target position information acquisition module, configured to determine target position information of a referenced target parameter in the initial abstract syntax tree;

[0019] a replacement module, configured to replace a target parameter in the initial abstract syntax tree with a parameter value acquisition function according to the target position information, to obtain a replaced abstract syntax tree; wherein, when the parameter value acquisition function is called, the module is configured to run a target program code corresponding to the target parameter to obtain a parameter value of the target parameter;

[0020] The code conversion module is used to perform code conversion on the replaced abstract syntax tree to obtain the replaced program code and run it.

[0021] According to a fourth aspect of an embodiment of the present application, another data processing apparatus is provided, located in a client device, including:

[0022] A display module is used to display the target component on the device display interface;

[0023] a dependency property determining module, configured to determine a dependency property that depends on the target property in response to a property value adjustment operation on the target property of the target component;

[0024] a program code loading module, configured to load a replaced program code corresponding to the dependency property; wherein the replaced program code is program code obtained by replacing a target parameter referenced in the source program code with a parameter value acquisition function; when the parameter value acquisition function is called, the target program code corresponding to the target parameter is executed to acquire a parameter value of the target parameter; the source program code is configured to acquire a property value of the dependency property; and the target parameter includes a parameter corresponding to the target property;

[0025] The updated attribute value obtaining module is used to run the replaced program code to obtain the updated attribute value of the dependent attribute.

[0026] According to the fifth aspect of the embodiments of the present application, an electronic device is provided, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other through the communication bus; the memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform an operation corresponding to the data processing method described in the first aspect or the second aspect.

[0027] According to a sixth aspect of an embodiment of the present application, a computer storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the data processing method as described in the first aspect is implemented.

[0028] According to the data processing method provided by the embodiment of the present application, after obtaining the source program code containing the parameter reference relationship, all referenced target parameters are replaced with parameter value acquisition functions with the help of the abstract syntax tree, thereby forming the replaced program code. In this way, if the replaced program code is run, the parameter values ​​of all referenced parameters will not be obtained at once. Instead, when the code runs to the parameter value acquisition function position, the parameter value of the target parameter is obtained. On the contrary, when the parameter value acquisition function does not need to be run in the end based on the logical relationship in the program code, there is no need to perform the parameter value acquisition operation of the target parameter. Therefore, the embodiment of the present application can effectively improve the efficiency of parameterized calculation. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.

[0030] Figure 1 is an exemplary program code for performing parameterized calculations in the related art;

[0031] Figure 2 This is a flowchart of a data processing method according to Embodiment 1 of the present application;

[0032] Figure 3 for Figure 2 A schematic diagram of an example scenario in the illustrated embodiment;

[0033] Figure 4 This is a flowchart of a data processing method according to the second embodiment of the present application;

[0034] Figure 5 for Figure 1 The initial abstract syntax tree corresponding to the source code shown on the left;

[0035] Figure 6 This is a flowchart of a data processing method according to the third embodiment of the present application;

[0036] Figure 7 for Figure 6 A schematic diagram of the dependency relationship between attributes in the embodiment shown;

[0037] Figure 8 Schematic diagram of the chain reaction caused by the attribute value adjustment operation;

[0038] Figure 9 This is a structural block diagram of a data processing device according to the fourth embodiment of the present application;

[0039] Figure 10 This is a structural block diagram of a data processing device according to the fifth embodiment of the present application;

[0040] Figure 11 This is a structural diagram of an electronic device according to Example 6 of the present application. DETAILED DESCRIPTION

[0041] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the embodiments of the present application, all other embodiments obtained by ordinary technicians in this field should fall within the scope of protection of the embodiments of the present application.

[0042] The specific implementation of the embodiment of the present application is further explained below in conjunction with the accompanying drawings of the embodiment of the present application.

[0043] Example 1

[0044] Reference Figure 2 , Figure 2 1 is a flowchart of a data processing method according to Embodiment 1 of the present application. Specifically, the data processing method provided in this embodiment includes the following steps:

[0045] Step 202: Obtain an initial abstract syntax tree corresponding to the source program code, where the source program code includes parameter reference relationships.

[0046] An Abstract Syntax Tree (AST) is a tree representation of the abstract syntax structure of source code. Each node in the tree represents a structure in the source code. It is a representation method that converts source code into a tree structure based on the abstract syntax structure. The AST describes how statements in a programming language are derived from the grammatical structure. Nodes in the AST are divided into different types, such as binary expressions, declarations, and function definitions.

[0047] Existing static analysis and verification tools can be used to perform lexical analysis and syntactic analysis on the source code to generate an abstract syntax tree corresponding to the source code. In the embodiment of the present application, since the abstract syntax tree corresponding to the source code is processed in subsequent steps, in order to better distinguish the abstract syntax trees before and after processing, the abstract syntax obtained after lexical and syntactic analysis is called the initial syntax tree.

[0048] Step 204: Determine the target position information of the referenced target parameter in the initial abstract syntax tree.

[0049] After obtaining the initial abstract syntax tree corresponding to the source program code, the structure of the initial abstract syntax tree can be traversed to determine the location where the parameter reference exists. In an embodiment of the present application, the referenced parameter is referred to as the target parameter, and the position of the target parameter in the initial abstract syntax tree is referred to as the target position. In this step, the entire initial abstract syntax tree can be traversed to determine the target position information of the target parameter. Those skilled in the art will understand that in the initial abstract syntax tree corresponding to a section of source program code, there may be only one referenced parameter or there may be multiple referenced parameters. Therefore, correspondingly, in this step, there may be only one target parameter or there may be multiple target parameters.

[0050] Step 206 : According to the target position information, the target parameter in the initial abstract syntax tree is replaced with a parameter value acquisition function to obtain a replaced abstract syntax tree.

[0051] Wherein, when the parameter value acquisition function is called, it is used to run the target program code corresponding to the target parameter to obtain the parameter value of the target parameter;

[0052] Specifically, a parameter value acquisition function can be constructed based on the parameter name of the target parameter, and then, according to the target position information of the target parameter in the initial syntax tree determined in step 204, the target parameter in the initial abstract syntax tree is replaced with the parameter value acquisition function, thereby obtaining a replaced abstract syntax tree.

[0053] Step 208: Perform code conversion on the replaced abstract syntax tree to obtain the replaced program code and run it.

[0054] In this step, after obtaining the replaced program code, the replaced program code can be run to obtain the calculation result of the parameterized calculation.

[0055] See also Figure 3 , Figure 3 This is a schematic diagram of the scene corresponding to the first embodiment of the present application. Figure 3 The schematic diagram shown in the figure illustrates an embodiment of the present application using a specific scenario as an example:

[0056] Also Figure 1Taking the source program code containing 4 referenced target parameters a, b, c and d as an example, first obtain the initial abstract syntax tree corresponding to the source program code; then, in the initial abstract syntax tree, determine the target position information of the referenced target parameters, specifically including: target position information M of target parameter a, target position information N of target parameter b, target position information P of target parameter C, and target position information Q of target parameter d; then, based on the target position information M, N, P, and Q respectively, replace the target parameters in the initial abstract syntax tree with parameter value acquisition functions, thereby obtaining the replaced abstract syntax tree, specifically: replace the target parameter a with the parameter value acquisition function The parameter value acquisition function is replaced by the parameter value acquisition function: get("a"), so that when the parameter value acquisition function is called, the parameter value of the target parameter a can be obtained; the target parameter b is replaced by the parameter value acquisition function: get("b"), so that when the parameter value acquisition function is called, the parameter value of the target parameter b can be obtained; the target parameter c is replaced by the parameter value acquisition function: get("c"), so that when the parameter value acquisition function is called, the parameter value of the target parameter c can be obtained; the target parameter d is replaced by the parameter value acquisition function: get("d"), so that when the parameter value acquisition function is called, the parameter value of the target parameter d can be obtained; based on the abstract syntax tree after replacement, the following is generated again Figure 3 Replace the program code shown in and run it.

[0057] In an embodiment of the present application, after obtaining the source program code containing the parameter reference relationship, all referenced target parameters are replaced with parameter value acquisition functions with the help of the abstract syntax tree, thereby forming the replaced program code. In this way, if the replaced program code is run, the parameter values ​​of all referenced parameters will not be obtained at once. Instead, when the code runs to the parameter value acquisition function position, the parameter value of the target parameter is obtained. On the contrary, when, based on the logical relationship in the program code, it is ultimately not necessary to run the parameter value acquisition function, there is no need to perform the parameter value acquisition operation of the target parameter. Therefore, the embodiment of the present application can effectively improve the efficiency of parameterized calculation.

[0058] The data processing method of the embodiment of the present application can be executed by any appropriate electronic device with data processing capabilities, including but not limited to: servers, mobile terminals (such as mobile phones, PADs, etc.) and PCs, etc.

[0059] The data processing method provided in the embodiments of the present application can be applied to a variety of different scenarios.

[0060] Such as: product design, three-dimensional modeling, specifically: taking home product design as an example, due to the constraints of later product processing technology, indoor space location, etc., the design process of each product usually involves dozens or even hundreds of parameters (each parameter can correspond to a property of the product, such as: length, height, thickness, etc.) and different parameters may be interdependent and constrained to meet certain linkage relationships. Based on the above situation, the data processing method provided in the embodiment of the present application can be applied to a client device installed with a product design application. When the product designer user adjusts a certain attribute value of a product component in the display interface of the client device, after determining the dependent attribute that depends on the above attribute value, the data processing method provided in the embodiment of the present application can be used to load and run the replaced program code corresponding to the above-determined dependent attribute to obtain the updated attribute value of each dependent attribute.

[0061] Another example: dimension chain calculation, specifically: for a product assembled from multiple different parts, the dimensions of the internal components also satisfy certain constraints. When one of the dimensions changes, it may cause other dimensions to be updated. Therefore, in the scenario of dimension chain calculation, when a dimension value changes, after determining the dependent dimensions that depend on the above dimensions, the data processing method provided in this embodiment can be used to load and run the replaced program code corresponding to the dependent dimensions, and then obtain the updated dimension value of the dependent dimension to complete the update calculation of the dimension chain, etc.

[0062] Example 2

[0063] Reference Figure 4 , Figure 4 1 is a flowchart of a data processing method according to Embodiment 2 of the present application. Specifically, the data processing method provided in this embodiment includes the following steps:

[0064] Step 402: Obtain an initial abstract syntax tree corresponding to the source program code, where the source program code includes parameter reference relationships.

[0065] Furthermore, the initial abstract syntax tree corresponding to the source code can be obtained in the following way:

[0066] Get source code;

[0067] Perform lexical analysis and syntactic analysis on the source code to generate an initial abstract syntax tree corresponding to the source code.

[0068] When performing lexical analysis and grammatical analysis on the source program code to generate an initial abstract syntax tree, reference may be made to the specific analysis method implementation in the related art, which will not be described in detail here.

[0069] Step 404: Determine all referenced variables in the initial abstract syntax tree.

[0070] By traversing the initial abstract syntax tree, all referenced variables can be identified. These referenced variables may include variables directly defined in the source code, or parameters that require calling other program code segments to obtain specific values.

[0071] See also Figure 5 , Figure 5 for Figure 1 The initial abstract syntax tree corresponding to the source code shown on the left is obtained by using existing static analysis verification tools. Figure 1 The source code shown on the left is generated after lexical and grammatical analysis. In this step, the initial abstract syntax tree can be traversed to determine all referenced variables. The specific method is: determine all target parts containing "IdentNode" from the initial abstract syntax tree (such as Figure 5 Then, based on the target part, all referenced variables are determined: a, b, c, and d.

[0072] Step 406: Determine the defined variables contained in the source code.

[0073] The defined variables in this step are variables that are directly defined in the source code, rather than variables (parameters) that require calling other program code segments to obtain specific values.

[0074] Step 408: Determine all referenced variables except the defined variables as referenced target parameters, and obtain target position information of the target parameters.

[0075] See also Figure 1 In the left figure, since the variables a, b, c and d are not directly defined in the source code, in this step, all the referenced variables a, b, c and d determined in step 404 are determined as referenced target parameters, and the target position information of a, b, c and d in the initial abstract syntax tree is obtained.

[0076] Step 410: Obtain a predefined initial parameter value acquisition function.

[0077] Among them, the initial parameter value acquisition function is used to obtain the parameter value of the input parameter.

[0078] In the embodiment of the present application, there is no limitation on the specific form of the initial parameter value acquisition function. For example, a function get("u") can be pre-defined so that when the function is called, the parameter value of the incoming parameter "u" can be obtained; or a function value("u") can be pre-defined so that when the function is called, the parameter value of the incoming parameter "u" can be obtained, and so on.

[0079] Step 412: Use the parameter name of the target parameter as an input parameter of the initial parameter value acquisition function to construct the parameter value acquisition function.

[0080] Taking the target parameter a as an example, the parameter name "a" of the target parameter can be used as the input parameter of the initial parameter value acquisition function (assuming that the initial parameter value acquisition function is in the form of get("u")), and the parameter value acquisition function is constructed: get("a"). When the parameter value acquisition function is called, the target program code corresponding to the target parameter can be run to obtain the parameter value of the target parameter.

[0081] Step 414 : According to the target position information, the target parameter in the initial abstract syntax tree is replaced with a parameter value acquisition function to obtain a replaced abstract syntax tree.

[0082] In this step, when there are multiple target parameters, in order to improve the efficiency of parameterized calculation, all target parameters can be replaced with corresponding parameter value acquisition functions to obtain a replaced abstract syntax tree.

[0083] Step 416: perform code conversion on the replaced abstract syntax tree to obtain the replaced program code and run it.

[0084] In an embodiment of the present application, after obtaining the source program code containing the parameter reference relationship, all referenced target parameters are replaced with parameter value acquisition functions with the help of the abstract syntax tree, thereby forming the replaced program code. In this way, if the replaced program code is run, the parameter values ​​of all referenced parameters will not be obtained at once. Instead, when the code runs to the parameter value acquisition function position, the parameter value of the target parameter is obtained. On the contrary, when, based on the logical relationship in the program code, it is ultimately not necessary to run the parameter value acquisition function, there is no need to perform the parameter value acquisition operation of the target parameter. Therefore, the embodiment of the present application can effectively improve the efficiency of parameterized calculation.

[0085] The data processing method of this embodiment can be executed by any appropriate electronic device with data processing capabilities, including but not limited to: a server, a mobile terminal (such as a mobile phone, a PAD, etc.) and a PC.

[0086] Example 3

[0087] Reference Figure 6 , Figure 6This is a flowchart of the steps of a data processing method according to Example 3 of the present application.

[0088] The application scenarios of this embodiment can be: component design scenarios, such as: home product (wardrobes, tables and chairs, etc.) design, etc. Taking home product design as an example, in this scenario, due to the constraints of later product processing technology, indoor space location, etc., the design process of each product usually involves dozens or even hundreds of attributes (each attribute corresponds to a parameter), such as: length, height, thickness, etc., which are used to describe the specific size of the product. In addition, the attributes of different components may be interdependent and constrained to meet certain linkage relationships (formulas), that is, some attribute values ​​may need to rely on other attribute values ​​and be calculated through formulas. Figure 7 In this example, there are seven components involved, namely A, B, C, D, E, F, and G. Attribute 1 (length) and attribute 2 (width) of component A both depend on attribute 1 (width) of component B and attribute 2 (width) of component C, and are calculated using Formula 1 and Formula 2. Attribute 2 (width) of component D depends on attribute 2 of component C and attribute 2 (width) of component E, and is calculated using Formula 3. Attribute 1 (length) of component F depends on attribute 1 (length) of component G, and is calculated using Formula 4.

[0089] In this case, during the design process, when the designer user adjusts the attribute value of a component in the display interface in the client device of the design application, the attribute values ​​of other attributes that depend on the attribute (referred to as dependent attributes in the embodiment of the application) need to be recalculated accordingly. Figure 7 When the attribute value of attribute 1 (length) of component B is changed, the attribute values ​​of the dependent attributes (attribute 1 and attribute 2 of component A) that depend on attribute 1 of component B need to be recalculated.

[0090] In the embodiments of the present application, each property corresponds to a source code segment for obtaining the property value, and each source code segment typically includes one or more parameters. For dependent properties, the parameters included therein must include a target parameter corresponding to the target property on which the dependent property depends. That is, if dependent property 1 depends on target property 2, then the source code corresponding to dependent property 1 must include target parameter 2 corresponding to target property 2, the parameter value of target parameter 2 being equal to the property value of target property 2, and target property 2 corresponding to a program code segment for obtaining the property value.

[0091] See also Figure 8 , Figure 8 Schematic diagram of the chain reaction caused by the attribute value adjustment operation, combined with Figure 8It can be seen that when a designer user changes (adjusts) an attribute value (for example, if the length of a component is adjusted, the attribute value representing the length will change); at the same time, since these attribute values ​​have changed, the attribute values ​​of the dependent attributes that depend on these attribute values ​​also need to be recalculated (refreshed). This layer-by-layer attribute dependency and refresh relationship eventually forms a chain reaction, just like an atomic bomb explosion, and the CPU consumption of the calculation process may be huge.

[0092] During the property value adjustment and update process, if some dependencies can be cut out, a lot of CPU consumption can be saved in the above "chain reaction".

[0093] In the embodiment of the present application, the source code corresponding to the dependency attribute is preprocessed: with the help of the abstract syntax tree, all the referenced target parameters in the source code are replaced with parameter value acquisition functions. In this way, if the preprocessed program code is run, it is not necessary to execute all the links that may be involved in the above chain reaction. Instead, according to the limitation of the logical relationship, when the code runs to the parameter value acquisition function position, the parameter value of the target parameter is obtained. On the contrary, when it is not necessary to run the parameter value acquisition function based on the logical relationship in the program code, there is no need to perform the parameter value acquisition operation of the target parameter, that is: when a link needs to be executed, the corresponding dependency relationship is retained and the corresponding parameter value acquisition function is run; when no link needs to be executed, the corresponding dependency relationship can be deleted, and there is no need to run the parameter value acquisition function for calculation. Therefore, the embodiment of the present application can effectively improve the update speed of the component attribute value, thereby improving the user's operating experience (after executing the attribute value adjustment operation, the background can quickly synchronize the attribute values ​​of all related dependent attribute values ​​so that users can design products efficiently).

[0094] Specifically, the data processing method provided in this embodiment is applied to a client device and includes the following steps:

[0095] Step 602: Display the target component on the device display interface.

[0096] In this step, there is no limitation on the specific display form of the target component in the display section. For example, it can be displayed in the form of a three-dimensional model, a two-dimensional model, a table, etc.

[0097] Step 604 : In response to the property value adjustment operation on the target property of the target component, determine the dependent property that depends on the target property.

[0098] Step 606: Load the replaced program code corresponding to the dependency attribute.

[0099] Among them, the replaced program code is the program code after replacing the target parameter referenced in the source program code with the parameter value acquisition function; when the parameter value acquisition function is called, it is used to run the target program code corresponding to the target parameter to obtain the parameter value of the target parameter; the source program code is used to obtain the property value of the dependent property; the target parameter includes the parameter corresponding to the target property.

[0100] Specifically, in the embodiment of the present application, there are two ways to load the replaced program code corresponding to the dependency attribute:

[0101] The first method: the source program codes corresponding to all attribute values ​​of all components that may be involved in the scenario are stored in the server device. When the attribute value adjustment operation of the target attribute of the target component is detected and the dependent attribute that depends on the target attribute is determined, the source program code corresponding to the dependent attribute is obtained from the server device, and the source program code is processed into the replaced program code.

[0102] Specifically: obtaining source program code from a server-side device, and obtaining an initial abstract syntax tree corresponding to the source program code; determining target position information of a referenced target parameter in the initial abstract syntax tree; replacing the target parameter in the initial abstract syntax tree with a parameter value acquisition function based on the target position information to obtain a replaced abstract syntax tree; wherein, when the parameter value acquisition function is called, it is used to run the target program code corresponding to the target parameter to obtain the parameter value of the target parameter; performing code conversion on the replaced abstract syntax tree to obtain a replaced program code corresponding to the dependency attribute.

[0103] The second method: In advance, the source program codes corresponding to all attribute values ​​of all components that may be involved in the scenario are processed separately in the server device to obtain the replaced program code, and stored in the server device. When the client device detects the attribute value adjustment operation of the target attribute of the target component and determines the dependent attribute that depends on the target attribute, it obtains the replaced program code corresponding to the dependent attribute from the server device.

[0104] Specifically: the replaced program code corresponding to the dependent attribute is loaded from the server device; the replaced program code is pre-stored in the server device before the step of determining the dependent attribute that depends on the target attribute in response to the attribute value adjustment operation of the target attribute in the target component.

[0105] Step 608: Run the replaced program code to obtain the updated property value of the dependent property.

[0106] In the embodiment of the present application, after the client device detects the property value adjustment operation of the target property and determines the dependent property, it loads and runs the replaced program code corresponding to the dependent property, and the above-mentioned replaced program code is formed by replacing all the referenced target parameters in the source program code with parameter value acquisition functions with the help of an abstract syntax tree. In this way, when the replaced program code is run to perform the property value update calculation of the dependent property, the parameter values ​​of all referenced target parameters will not be obtained first. Instead, when the code runs to the parameter value acquisition function position, the parameter value of the target parameter is obtained. On the contrary, when it is not necessary to run the parameter value acquisition function in the end based on the logical relationship in the program code, there is no need to perform the parameter value acquisition operation of the target parameter. Therefore, the embodiment of the present application can effectively improve the update speed of the component property value, thereby improving the user's operating experience (after executing the property value adjustment operation, the background can quickly synchronize the property value adjustments of all related dependent property values, so that users can efficiently perform product design).

[0107] Example 4

[0108] See also Figure 9 , Figure 9 : This is a structural block diagram of a data processing device according to the fourth embodiment of the present application. The data processing device provided in this embodiment of the present application includes:

[0109] The initial abstract syntax tree acquisition module 902 is used to acquire the initial abstract syntax tree corresponding to the source program code; the source program code contains parameter reference relationships;

[0110] A target position information acquisition module 904 is used to determine the target position information of the referenced target parameter in the initial abstract syntax tree;

[0111] a replacement module 906 for replacing the target parameter in the initial abstract syntax tree with a parameter value acquisition function according to the target position information to obtain a replaced abstract syntax tree; wherein, when the parameter value acquisition function is called, it is configured to run the target program code corresponding to the target parameter to obtain the parameter value of the target parameter;

[0112] The code conversion module 908 is used to perform code conversion on the replaced abstract syntax tree to obtain the replaced program code and run it.

[0113] Optionally, in some embodiments, the replacement module 906 is specifically configured to:

[0114] Obtain a predefined initial parameter value acquisition function; wherein the initial parameter value acquisition function is used to obtain the parameter value of the input parameter;

[0115] Use the parameter name of the target parameter as the input parameter of the initial parameter value acquisition function to build the parameter value acquisition function;

[0116] According to the target position information, the target parameter in the initial abstract syntax tree is replaced with the parameter value acquisition function to obtain a replaced abstract syntax tree.

[0117] Optionally, in some embodiments, the target location information acquisition module 904 is specifically configured to:

[0118] In the initial abstract syntax tree, identify all referenced variables;

[0119] Identify defined variables contained in source code;

[0120] All referenced variables except defined variables are determined as referenced target parameters, and target position information of the target parameters is obtained.

[0121] Optionally, in some embodiments, the initial abstract syntax tree acquisition module 902 is specifically configured to:

[0122] Get source code;

[0123] Perform lexical analysis and syntactic analysis on the source code to generate an initial abstract syntax tree corresponding to the source code.

[0124] The data processing device of the embodiment of the present application is used to implement the corresponding data processing method in the above-mentioned method embodiment 1 or embodiment 2, and has the beneficial effects of the corresponding method embodiment, which will not be described in detail here. In addition, the functional implementation of each module in the data matching device of the embodiment of the present application can refer to the description of the corresponding parts in the above-mentioned method embodiment 1 or embodiment 2, and will not be described in detail here.

[0125] Example 5

[0126] Reference Figure 10 , Figure 10 This is a structural block diagram of a data processing device according to the fifth embodiment of the present application. The data processing device provided in the embodiment of the present application is located in a client device and includes:

[0127] Display module 1002, used to display the target component on the device display interface;

[0128] A dependency property determination module 1004 is configured to determine a dependency property that depends on a target property in response to a property value adjustment operation on a target property of a target component;

[0129] The program code loading module 1006 is used to load the replaced program code corresponding to the dependency property; wherein the replaced program code is the program code after replacing the target parameter referenced in the source program code with the parameter value acquisition function; when the parameter value acquisition function is called, the target program code corresponding to the target parameter is executed to acquire the parameter value of the target parameter; the source program code is used to acquire the property value of the dependency property; the target parameter includes the parameter corresponding to the target property;

[0130] The updated attribute value obtaining module 1008 is used to run the replaced program code to obtain the updated attribute value of the dependent attribute.

[0131] Optionally, in some embodiments, the program code loading module 1006 is specifically configured to:

[0132] Obtaining source program code from a server device and obtaining an initial abstract syntax tree corresponding to the source program code;

[0133] In the initial abstract syntax tree, determine the target position information of the referenced target parameter;

[0134] Based on the target position information, the target parameter in the initial abstract syntax tree is replaced with a parameter value acquisition function to obtain a replaced abstract syntax tree; wherein, when the parameter value acquisition function is called, the target program code corresponding to the target parameter is executed to obtain the parameter value of the target parameter;

[0135] The replaced abstract syntax tree is converted into code to obtain the replaced program code corresponding to the dependency property.

[0136] Optionally, in some embodiments, the program code loading module 1006 is specifically configured to:

[0137] The replaced program code corresponding to the dependent attribute is loaded from the server device; the replaced program code is pre-stored in the server device before the step of determining the dependent attribute that depends on the target attribute in response to the attribute value adjustment operation of the target attribute in the target component.

[0138] The data processing device of the embodiment of the present application is used to implement the corresponding data processing method in the aforementioned method embodiment 3 and has the beneficial effects of the corresponding method embodiment, which will not be described in detail here. In addition, the functional implementation of each module in the data processing device of the embodiment of the present application can refer to the description of the corresponding parts in the aforementioned method embodiment 3, which will not be described in detail here.

[0139] Example 6

[0140] Reference Figure 11, shows a structural diagram of an electronic device according to embodiment six of the present application. The specific embodiments of the present application do not limit the specific implementation of the electronic device.

[0141] like Figure 11 As shown, the electronic device may include: a processor (processor) 1102 , a communication interface (Communications Interface) 1104 , a memory (memory) 1106 , and a communication bus 1108 .

[0142] in:

[0143] The processor 1102 , the communication interface 1104 , and the memory 1106 communicate with each other via a communication bus 1108 .

[0144] The communication interface 1104 is used to communicate with other electronic devices or servers.

[0145] The processor 1102 is configured to execute the program 1110 , and specifically to execute the relevant steps in the above-mentioned data processing method embodiment.

[0146] Specifically, the program 1110 may include program codes, which include computer operation instructions.

[0147] The processor 1102 may be a CPU, an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application. The one or more processors included in the smart device may be processors of the same type, such as one or more CPUs, or may be processors of different types, such as one or more CPUs and one or more ASICs.

[0148] The memory 806 is used to store the program 1110. The memory 1106 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0149] Program 1110 can be specifically used to enable processor 1102 to perform the following operations: obtain an initial abstract syntax tree corresponding to the source program code; the source program code contains a parameter reference relationship; in the initial abstract syntax tree, determine the target position information of the referenced target parameter; according to the target position information, replace the target parameter in the initial abstract syntax tree with a parameter value acquisition function to obtain a replaced abstract syntax tree; wherein, when the parameter value acquisition function is called, it is used to run the target program code corresponding to the target parameter to obtain the parameter value of the target parameter; perform code conversion on the replaced abstract syntax tree to obtain and run the replaced program code.

[0150] Alternatively, program 1110 can be specifically used to enable the processor 802 to perform the following operations: display the target component in the device display interface; determine the dependent attribute that depends on the target attribute in response to the attribute value adjustment operation of the target attribute of the target component; load the replaced program code corresponding to the dependent attribute; wherein the replaced program code is the program code after replacing the target parameter referenced in the source program code with the parameter value acquisition function; when the parameter value acquisition function is called, it is used to run the target program code corresponding to the target parameter to obtain the parameter value of the target parameter; the source program code is used to obtain the attribute value of the dependent attribute; the target parameter includes the parameter corresponding to the target attribute; run the replaced program code to obtain the updated attribute value of the dependent attribute.

[0151] The specific implementation of each step in program 1110 can be found in the corresponding descriptions of the corresponding steps and units in the above-mentioned data processing method embodiment, and will not be repeated here. Those skilled in the art will clearly understand that for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding process descriptions in the above-mentioned method embodiment, and will not be repeated here.

[0152] Through the electronic device of this embodiment, after obtaining the source program code containing the parameter reference relationship, all referenced target parameters are replaced with parameter value acquisition functions with the help of the abstract syntax tree, thereby forming the replaced program code. In this way, if the replaced program code is run, the parameter values ​​of all referenced parameters will not be obtained at once. Instead, when the code runs to the parameter value acquisition function position, the parameter value of the target parameter is obtained. On the contrary, when the parameter value acquisition function does not need to be run in the end based on the logical relationship in the program code, there is no need to perform the parameter value acquisition operation of the target parameter. Therefore, the embodiment of the present application can effectively improve the efficiency of parameterized calculation.

[0153] An embodiment of the present application also provides a computer program product, including computer instructions, which instruct a computing device to execute operations corresponding to any data processing method in the above-mentioned multiple method embodiments.

[0154] It should be pointed out that, according to the needs of implementation, the various components / steps described in the embodiments of the present application can be split into more components / steps, or two or more components / steps or partial operations of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present application.

[0155] The above-mentioned method according to the embodiment of the present application can be implemented in hardware, firmware, or be implemented as software or computer code that can be stored in a recording medium (such as CD ROM, RAM, floppy disk, hard disk or magneto-optical disk), or be implemented as computer code originally stored in a remote recording medium or a non-temporary machine-readable medium downloaded via a network and to be stored in a local recording medium, so that the method described herein can be stored in such software processing on a recording medium using a general-purpose computer, a special-purpose processor or programmable or special-purpose hardware (such as ASIC or FPGA). It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component (e.g., RAM, ROM, flash memory, etc.) that can store or receive software or computer code, and when the software or computer code is accessed and executed by a computer, a processor or hardware, the data processing method described herein is implemented. In addition, when a general-purpose computer accesses the code for implementing the data processing method shown here, the execution of the code converts the general-purpose computer into a special-purpose computer for executing the data processing method shown here.

[0156] Those skilled in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of this application.

[0157] The above implementation methods are only used to illustrate the embodiments of the present application, and are not intended to limit the embodiments of the present application. Ordinary technicians in the relevant technical field can make various changes and modifications without departing from the spirit and scope of the embodiments of the present application. Therefore, all equivalent technical solutions also fall within the scope of the embodiments of the present application, and the scope of patent protection of the embodiments of the present application should be defined by the claims.

Claims

1. A data processing method, comprising: Obtaining the initial abstract syntax tree corresponding to the source code; The source code contains parameter reference relationships; Determining target position information of a referenced target parameter in the initial abstract syntax tree; According to the target position information, the target parameter in the initial abstract syntax tree is replaced with a parameter value acquisition function to obtain a replaced abstract syntax tree; wherein, when the parameter value acquisition function is called, it is used to run the target program code corresponding to the target parameter to obtain the parameter value of the target parameter; Performing code conversion on the replaced abstract syntax tree to obtain replaced program code and running the replaced program code; The step of determining target position information of a referenced target parameter in the initial abstract syntax tree includes: In the initial abstract syntax tree, determining all referenced variables; Determining defined variables contained in the source program code; The target parameters are determined for all the referenced variables except the defined variables, and the target position information of the target parameters is obtained.

2. The method according to claim 1, wherein The step of replacing the target parameter in the initial abstract syntax tree with a parameter value acquisition function according to the target position information to obtain a replaced abstract syntax tree includes: Obtain a predefined initial parameter value acquisition function; wherein the initial parameter value acquisition function is used to obtain the parameter value of the input parameter; Using the parameter name of the target parameter as the input parameter of the initial parameter value acquisition function, constructing the parameter value acquisition function; According to the target position information, the target parameter in the initial abstract syntax tree is replaced with the parameter value acquisition function to obtain a replaced abstract syntax tree.

3. The method according to claim 1, wherein The obtaining of an initial abstract syntax tree corresponding to the source program code includes: Get source code; Performing lexical analysis and grammatical analysis on the source program code to generate an initial abstract syntax tree corresponding to the source program code.

4. A data processing method, applied to a client device, comprising: Display the target component in the device display interface; In response to a property value adjustment operation on a target property of the target component, determining a dependent property that depends on the target property; Loading the replaced program code corresponding to the dependency property; wherein the replaced program code is program code obtained by replacing the target parameter referenced in the source program code with a parameter value acquisition function; when the parameter value acquisition function is called, the target program code corresponding to the target parameter is executed to acquire the parameter value of the target parameter; the source program code is used to acquire the property value of the dependency property; the target parameter includes the parameter corresponding to the target property; The replaced program code is run to obtain the updated property value of the dependent property.

5. The method according to claim 4, wherein The loading of the replaced program code corresponding to the dependency attribute includes: Obtaining the source program code from a server device, and obtaining an initial abstract syntax tree corresponding to the source program code; Determining target position information of a referenced target parameter in the initial abstract syntax tree; Based on the target position information, a target parameter in the initial abstract syntax tree is replaced with a parameter value acquisition function to obtain a replaced abstract syntax tree; wherein, when the parameter value acquisition function is called, it is used to run a target program code corresponding to the target parameter to obtain a parameter value of the target parameter; Code conversion is performed on the replaced abstract syntax tree to obtain a replaced program code corresponding to the dependency attribute.

6. The method according to claim 4, wherein: The loading of the replaced program code corresponding to the dependency attribute includes: The replaced program code corresponding to the dependency attribute is loaded from the server device; the replaced program code is pre-stored in the server device before the step of determining the dependency attribute that depends on the target attribute in response to the attribute value adjustment operation of the target attribute in the target component.

7. A data processing device comprising: An initial abstract syntax tree acquisition module is used to obtain an initial abstract syntax tree corresponding to the source program code; The source code contains parameter reference relationships; a target position information acquisition module, configured to determine target position information of a referenced target parameter in the initial abstract syntax tree; a replacement module, configured to replace a target parameter in the initial abstract syntax tree with a parameter value acquisition function according to the target position information, to obtain a replaced abstract syntax tree; wherein, when the parameter value acquisition function is called, the module is configured to run a target program code corresponding to the target parameter to obtain a parameter value of the target parameter; A code conversion module, configured to perform code conversion on the replaced abstract syntax tree to obtain and run the replaced program code; Among them, the target position information acquisition module is also used to determine all referenced variables in the initial abstract syntax tree; determine the defined variables contained in the source program code; determine the target parameters for all referenced variables except the defined variables, and obtain the target position information of the target parameters.

8. A data processing device, located at a client device, comprising: A display module is used to display the target component on the device display interface; a dependency property determining module, configured to determine a dependency property that depends on the target property in response to a property value adjustment operation on the target property of the target component; a program code loading module, configured to load a replaced program code corresponding to the dependency property; wherein the replaced program code is program code obtained by replacing a target parameter referenced in the source program code with a parameter value acquisition function; when the parameter value acquisition function is called, the target program code corresponding to the target parameter is executed to acquire a parameter value of the target parameter; the source program code is configured to acquire a property value of the dependency property; and the target parameter includes a parameter corresponding to the target property; The updated attribute value obtaining module is used to run the replaced program code to obtain the updated attribute value of the dependent attribute.

9. An electronic device comprising: A processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform an operation corresponding to the data processing method according to any one of claims 1 to 3, or to perform an operation corresponding to the data processing method according to claims 4 to 6.

10. A computer storage medium having a computer program stored thereon, wherein when the program is executed by a processor, the computer program implements the data processing method according to any one of claims 1 to 3, or the data processing method according to claims 4 to 6.

11. A computer program product, comprising computer instructions, wherein the computer instructions instruct a computing device to execute operations corresponding to the data processing method according to any one of claims 1 to 3, or to execute operations corresponding to the data processing method according to claims 4 to 6.

Citation Information

Patent Citations

  • Automatic code conversion method and device, code converter and medium

    CN110471666A

  • Online coding dynamic effective method, device, equipment and medium

    CN111984241A