A function analysis method and computer device thereof

By introducing the reference parameter and dependency list mechanism into the function parser, the problem of parsing function parameters that are the results of other function expressions is solved, the organization of function expressions and the establishment of dependencies are realized, and the flexibility and accuracy of calculations are improved.

CN112799671BActive Publication Date: 2024-10-18BEIJING A&E TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN201911107908.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-11-13
Publication Date
2024-10-18
Estimated Expiration
2039-11-13

AI Technical Summary

Technical Problem

Existing function parsers cannot parse situations where function parameters are the result of other function expressions, making it difficult to establish functional organization and computational dependencies for embedded functions.

Method used

By introducing a reference parameter in the function expression, determining whether it is a reference parameter, and adding the reference index of the function to the dependency list of the referenced function, establishing the priority relationship of the referenced function, thereby realizing that the function parameters are other functions Parsing of expression results.

Benefits of technology

The organization of function expressions and the establishment of dependencies are realized, allowing function parameters to be analyzed as the results of other function expressions, improving the flexibility and accuracy of function calculations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112799671B_ABST
    Figure CN112799671B_ABST
Patent Text Reader

Abstract

The present application discloses a function parsing method, including: parsing the expression of a function to obtain function parameters; determining whether the function parameters are reference parameters; in response to the function parameters being reference parameters, adding the reference index corresponding to the function to the dependency list of the referenced function corresponding to the reference parameter to establish a priority relationship in which the referenced function takes precedence over the function for calculation. In the above manner, the present application can implement the parsing of functions whose function parameters are the results of other function expressions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computers, and in particular to a function parsing method and a computer device thereof. Background Art

[0002] The earlier function parser based on the dispatch yard algorithm used operands and operators as basic elements and could not support the parsing of embedded function expressions. By extending the algorithm, it can now support the parsing of embedded function expressions and solve the problem of function parameter parsing, that is, it can determine which parameters belong to the function.

[0003] In previous function parsing, different function names were required for functions with the same function but different numbers of parameters, which violated the principle of uniformity of function names and made users lack flexibility in using functions. Through further expansion of the algorithm, a method for determining the boundary of variable-parameter functions has been proposed, which can well solve the problem of being unable to determine the number of actual parameters based on the same function name, thereby realizing the support of the function parser for variable-parameter functions.

[0004] Despite this, there are still some problems in the current function parser. For example, the values ​​of the function parameters of the embedded function are limited to constant parameters, character parameters, and string parameters, and can only complete the independent functions of each function. However, if the implementation of a function depends on another function, it cannot be organized through the function expression, so it is impossible to parse the function whose function parameters are the results of other function expressions. Summary of the invention

[0005] The main technical problem solved by the present application is to provide a function parsing method and a computer device thereof, which can implement the parsing of functions whose function parameters are the results of other function expressions.

[0006] To solve the above technical problems, a technical solution adopted in the present application is: to provide a function parsing method, including: parsing the expression of the function to obtain the function parameters; determining whether the function parameters are reference parameters; in response to the function parameters being reference parameters, adding the reference index corresponding to the function to the dependency list of the referenced function corresponding to the reference parameter, so as to establish a priority relationship in which the referenced function takes precedence over the function for calculation.

[0007] The step of parsing the expression of the function includes: filling the expression of the function in the update list having the function, wherein if the expression of the function has a reference parameter, establishing a reference relationship between the function and the referenced function.

[0008] The reference parameter is the position number of the expression of the referenced function in the update list; the reference index is the position number of the expression of the function in the update list.

[0009] Among them, after the step of adding the reference index corresponding to the function to the dependency list of the referenced function corresponding to the reference parameter, it includes: determining whether the expression of the referenced function is updated; in response to the update of the expression of the referenced function, recalculating the expression of the referenced function and updating its calculation result.

[0010] Among them, in response to the update of the expression of the referenced function, the step of recalculating the expression of the referenced function and updating its calculation result includes: traversing the dependency list of the referenced function, updating the expressions and calculation results of all functions calculated after the referenced function.

[0011] The update list is a spreadsheet, and the position number in the list is the serial number of the spreadsheet.

[0012] The step of determining whether the function parameter is a reference parameter includes: in response to the function parameter not being a reference parameter, putting the function parameter into a function parameter list.

[0013] Among them, in response to the function parameter being a reference parameter, the step of adding the reference index corresponding to the function to the dependency list of the referenced function corresponding to the reference parameter includes: putting the function parameter into the function parameter list.

[0014] Among them, after the step of putting the function parameters into the function parameter list, the following steps are included: determining whether the function parameter traversal is completed; in response to the function parameter traversal being incomplete, returning to parse the function expression to obtain the function parameters.

[0015] To solve the above technical problems, another technical solution adopted in the present application is: to provide a computer device, including a processor, a memory and instructions stored therein, and the processor implements the steps of any of the above methods when executing the instructions.

[0016] The beneficial effects of the present application are as follows: different from the prior art, the present application replaces the expression of the referenced function with a reference parameter so that the expression of the function can be organized; the function parameter is determined to be a reference parameter, and the reference index corresponding to the function is added to the dependency list of the referenced function corresponding to the reference parameter to establish a priority relationship in which the referenced function takes precedence over the function for calculation, thereby realizing the parsing of functions whose function parameters are the results of other function expressions. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 It is a flowchart of an embodiment of the function parsing method of the present application;

[0018] Figure 2 It is a schematic diagram of a dependency list in an embodiment of a function parsing method of the present application;

[0019] Figure 3 It is a schematic diagram of a parameter list in an embodiment of a function parsing method of the present application;

[0020] Figure 4 It is a flowchart of another embodiment of the function parsing method of the present application;

[0021] Figure 5 It is a schematic diagram of updating a list before filling in a function expression in another embodiment of the function parsing method of the present application;

[0022] Figure 6 It is a schematic diagram of updating a list after filling in a function expression in another embodiment of the function parsing method of the present application;

[0023] Figure 7 It is a schematic diagram of two different updating methods of a referenced function in another embodiment of the function parsing method of the present application.

[0024] Figure 8 It is a structural diagram of an embodiment of a computer device of the present application. DETAILED DESCRIPTION

[0025] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions 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 present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0026] In the field of computer science, the shunting yard algorithm is a method for parsing mathematical expressions, especially infix expressions. Specifically, the shunting yard algorithm is used to convert infix expressions into postfix expressions or generate a code tree (AST) and obtain the relationship between various operators. Among them, the infix expression is a general arithmetic or logical formula representation method with operands and operators as basic elements. The operator is in the middle of the operand in infix form. The operator of the postfix expression is in postfix form after the operand. For example, the ordinary expression (infix expression): a+bc*d, the operands are a, b, c, d, the operators are +, -, *, and its postfix expression is abcd*-+.

[0027] By extending the algorithm, it is now possible to support parsing of embedded function expressions and solve the problem of function parameter parsing, that is, to determine which parameters belong to the function. However, the values ​​of the function parameters of embedded functions are limited to constant parameters, character parameters, and string parameters.

[0028] For example, the expression of the built-in function:

[0029] FuncA(a1,a2)+FuncB(b1,b2)-FuncC(c1,c2),

[0030] The function parameters of the function FuncA are a1 and a2, the function parameters of the function FuncB are b1 and b2, and the function parameters of the function FuncC are c1 and c2. The values ​​of a1, a2, b1, b2, c1, and c2 are limited to constant parameters, character parameters, and string parameters.

[0031] With the further expansion of the algorithm, the function parser supports variable parameter functions. For functions with the same function but different numbers of parameters, different function names need to be provided, which violates the principle of uniformity of function names and makes users lack flexibility in using functions. A method for determining the boundary of variable parameter functions has been proposed, which can well solve the problem of the inability to determine the number of actual parameters based on the same function name, thereby realizing the function parser's support for variable parameter functions. For example, the expression of an embedded variable parameter function:

[0032] VarFuncA(a1,a2)+VarFuncA(a3,a4,a5),

[0033] Among them, the values ​​of a1, a2, a3, a4, and a5 are limited to constant parameters, character parameters, and string parameters.

[0034] Figure 1 FIG. 1 is a flow chart showing an embodiment of the function parsing method of the present application. Figure 1 , the function parsing method in the embodiment of the present application comprises the steps of:

[0035] S11: parse the function expression to obtain function parameters.

[0036] Among them, function parameters include reference parameters and other parameters.

[0037] The reference parameter represents the expression of the corresponding referenced function so that the expression of the function can be organized. During the calculation of the function, the result of the referenced function expression can be called through the reference parameter to continue the calculation of the function expression. If the expression of the referenced function is directly filled into the expression of the function, the expression of the function cannot be organized, and thus cannot be parsed normally, and during the calculation of the function expression, the result of the expression of the associated referenced function cannot be called. Other parameters are parameters other than reference parameters. Other parameters can be constant parameters, character parameters, or string parameters.

[0038] This application introduces reference parameters to organize function expressions and establish dependencies between functions.

[0039] For example, the function expression FuncB(index_FuncA,b1,b2) is parsed to obtain the function parameter index_FuncA, where index_FuncA is a reference parameter. The expression of the referenced function corresponding to the reference parameter index_FuncA is FuncA(a1,a2), where a1 and a2 are constant parameters, character parameters, or string parameters.

[0040] For another example, a function expression is FuncB(index_FuncA,b1,b2)+FuncC(index_FuncA,c1),

[0041] It should be noted that the function expression is different from the function expression. The function expression can be a function expression or just the expression of one of the functions in the function expression. Parse the function expression FuncB(index_FuncA,b1,b2) to get the function parameter index_FuncA. Among them, index_FuncA is a reference parameter. The expression of the referenced function corresponding to the reference parameter index_FuncA is FuncA(a1,a2), among which a1 and a2 are constant parameters, character parameters or string parameters.

[0042] S12: Determine whether the function parameter is a reference parameter.

[0043] For example, determine whether the function parameter index_FuncA is a reference parameter.

[0044] A string representing the reference parameter can be used as the identification mark of the reference parameter. For example, "index_". A combination of characters and numbers can also be used as the identification mark of the reference parameter. For example, "A1", "B3", "E5". In this embodiment, there is no specific restriction on the naming method of the reference parameter, as long as the reference parameter can be determined during the parsing process.

[0045] S13: In response to the function parameter being a reference parameter, adding a reference index corresponding to the function to a dependency list of a referenced function corresponding to the reference parameter, so as to establish a priority relationship in which the referenced function is calculated before the function.

[0046] By establishing a priority relationship in which the referenced function is calculated before the function in the above manner, the referenced function can be calculated first in the subsequent function calculation process, so that the result of the referenced function can be used for the calculation of the function.

[0047] Among them, the dependency list is a list that stores the priority relationship between the referenced function and all the functions that reference the referenced function. Generally, the dependency list has rows and columns. Based on the columns, it can be from front to back, the priority of the function in the previous column is higher than the priority of the function in the next column. Based on the rows, it can be from front to back, the priority of the function in the previous row is higher than the priority of the function in the next row. In addition, as long as the priority relationship between the function and the referenced function can be established, the specific method is not limited. Optionally, the dependency list can be a spreadsheet.

[0048] For example, if it is determined that the function parameter index_FuncA is a reference parameter, the reference index corresponding to the function FuncB is added to the dependency list of the referenced function FuncA corresponding to the reference parameter index_FuncA, so as to establish a priority relationship in which the referenced function FuncA is calculated before the function FuncB. In the subsequent calculation process of the function FuncB, the referenced function FuncA can be calculated first, so that the result of the referenced function FuncA can be used for the calculation of the function FuncB.

[0049] For example, see Figure 2 , Figure 2: is a schematic diagram of the dependency list in the first embodiment of the function parsing method of the present application. In the dependency list sheet2 of the function FuncA, the priority relationship between the referenced function FuncA and all functions (such as FuncB, FuncC and FuncD) that reference the referenced function is stored. Among them, the reference index of the FuncB function is sheet1! C3, the reference index of the FuncC function is sheet1! C4, and the reference index of the FuncD function is sheet1! C5. The positional relationship between sheet1! C3, sheet1! C4 and sheet1! C5 and FuncA in the dependency list sheet2 is shown as follows: Figure 2 As shown, the priority of the function in column A is higher than the priority of the function corresponding to each reference index in column B, so as to establish a priority relationship in which the referenced function takes precedence over the function for calculation.

[0050] Different from the related art, the present application replaces the expression of the referenced function with a reference parameter so that the expression of the function can be organized; the function parameter is determined to be a reference parameter, and the reference index corresponding to the function is added to the dependency list of the referenced function corresponding to the reference parameter to establish a priority relationship in which the referenced function takes precedence over the function for calculation, thereby realizing the parsing of functions whose function parameters are the results of other function expressions.

[0051] Continue reading Figure 1 , the function parsing method in the embodiment of the present application further includes:

[0052] After step S12: determining whether the function parameter is a reference parameter, the following steps are also included:

[0053] In response to the function parameter not being a reference parameter, step S14 is executed.

[0054] Specifically, if the function parameter is not a reference parameter, step S14 is executed.

[0055] For example, b1 is a constant parameter, a character parameter or a string parameter. When the parsed function parameter is b1, step S14 is executed.

[0056] S14: Put the function parameters into the function parameter list.

[0057] The parameter list refers to a list storing the function parameters of the function, wherein the function parameter list can be a spreadsheet.

[0058] For example, see Figure 3 , Figure 3This is a schematic diagram of the parameter list in the first embodiment of the function parsing method of the present application. When the function parameter is a reference parameter index_FuncA, index_FuncA is placed in the parameter list sheet3 of the function FuncB; when the function parameter is not a reference parameter, the function parameter b1 or b2 is placed in the parameter list sheet3 of the function FuncB.

[0059] S15: Determine whether the function parameter traversal is completed.

[0060] For example, it is determined whether the function parameters index_FuncA, b1, and b2 of the function FuncB are all parsed, wherein whether the function parameter traversal is completed can be determined by determining whether the right bracket ")" in the expression of the function is parsed.

[0061] In response to the function parameter traversal being incomplete, the process returns to step S11 to continue parsing the next function parameter of the function.

[0062] In response to the function parameter traversal being completed, function parsing is completed.

[0063] After the parsing of a function is completed, you can continue to parse the expressions of other functions in the function expression until the parsing of the function expression is completed.

[0064] For example, if the right bracket ")" is not found during the parsing process, the function parameter traversal is considered incomplete, otherwise, the function parameter traversal is considered complete. After the parsing of the function FuncB is completed, the expressions of other functions in the function expression will continue to be parsed, such as FuncC(index_FuncA,c1), until the parsing of the function expression is completed.

[0065] The present application obtains all function parameters parsed by the function by putting the function parameters into a function parameter list, and determines whether the parsing of the function is completed by determining whether the function parameter traversal is completed.

[0066] Figure 4 FIG. 2 is a flow chart showing another embodiment of the function parsing method of the present application. Figure 4 , the function parsing method in the embodiment of the present application comprises the steps of:

[0067] S21: Fill in the expression of the function in the update list having the function, wherein if the expression of the function is a reference parameter, a reference relationship between the function and the referenced function is established.

[0068] Among them, the introduction of reference parameters in the function expression, on the one hand, allows the function expression to be organized to facilitate the parsing of the function, and on the other hand, the result of the referenced function can be called during the calculation process of the function.

[0069] For example, the function expression is FuncB(index_FuncA,b1,b2), and the function expression FuncB(index_FuncA,b1,b2) is filled in the update list with function FuncB, wherein the function expression has a reference parameter index_FuncA, and a reference relationship between function FuncB and the referenced function FuncA can be established.

[0070] Optionally, the reference parameter is the position number of the expression of the referenced function in the update list. Each position number is unique. The position number can be a character, a string, or a combination of at least two of the characters, numbers, and strings. Generally, the update list has rows and columns, so position numbers can be set for the rows and columns of the update list, so that the position where the expression of the referenced function in the update list is located also has a position number, and the position number is unique. If the update list itself has a unique position number, the step of setting the position number can be omitted.

[0071] For example, when the list is a row with multiple columns, the position number can be the character A, where A can be the position number of one of the columns; when the list is multiple rows and one column, the position number can be the character A, where A can be the position number of one of the rows; when the list is multiple rows and multiple columns, the position number can be the string AB, where A is the position number of the row and B is the position number of the column. The position number can also be defined according to actual needs.

[0072] Optionally, the update list can be a spreadsheet. The position number in the update list is the serial number of the spreadsheet. By using the spreadsheet as the update list of the function, the process of customizing the function numbering can be simplified.

[0073] For example, see Figure 5 , Figure 5 A schematic diagram of updating the list before filling in the expression of the function in another embodiment of the function parsing method of the present application. Before filling in the expression of the function, the expression of the referenced function FuncA(a1,a2) already exists in the update list sheet1. The cell where the expression of the referenced function FuncA(a1,a2) is located is in the 3rd row and the B column, so the position number is B3.

[0074] See also Figure 6 , Figure 6 A schematic diagram of updating the list after filling in the function expression in another embodiment of the function parsing method of the present application. After filling in the function expression FuncB(sheet1!B3,b1,b2), the cell where the function expression FuncB(sheet1!B3,b1,b2) in the updated list sheet1 is located in the 3rd row and the Cth column, and the position number is sheet1!C3.

[0075] The update list may be a single list or a list composed of multiple lists.

[0076] For example, when the update list is a combination of sheet1 and sheet2, when the expression of the referenced function FuncA(a1,a2) is located in the spreadsheet sheet1, the cell where it is located is in the 3rd row and the Bth column, then the position number is sheet1!B3; when the expression of the function FuncB(sheet1!B3,b1,b2) is located in the spreadsheet sheet2, the cell where it is located is in the 3rd row and the Cth column, then the position number is sheet2!C3.

[0077] S22: parse the function expression to obtain function parameters.

[0078] In this embodiment, the description of this step can refer to the description of the corresponding position in the first embodiment of the function analysis method, and will not be repeated here.

[0079] S23: Determine whether the function parameter is a reference parameter.

[0080] In this embodiment, the description of this step can refer to the description of the corresponding position in the first embodiment of the function analysis method, and will not be repeated here.

[0081] S24: In response to the function parameter being a reference parameter, adding a reference index corresponding to the function to a dependency list of a referenced function corresponding to the reference parameter, so as to establish a priority relationship in which the referenced function is calculated before the function.

[0082] The reference index is the position number of the function's expression in the update list.

[0083] For example, see Figure 2 and Figure 6 , the function expression is FuncB(sheet1!B3,b1,b2), and the position number of the function expression is sheet1!C3. Add sheet1!C3 as the reference index corresponding to FuncB(sheet1!B3,b1,b2) to the dependency list of the referenced function FuncA corresponding to the reference parameter sheet1!B3. The dependency list is a list different from the update list. Optionally, the dependency list can also be a spreadsheet.

[0084] In response to the function parameter not being a reference parameter, step S26 is executed.

[0085] In this embodiment, the description of this step can refer to the description of the corresponding position in the first embodiment of the function analysis method, and will not be repeated here.

[0086] S26: Determine whether the function parameter traversal is completed.

[0087] In response to the incomplete traversal of the function parameters, the process returns to step S22 to continue parsing the next parameter of the function.

[0088] In response to the completion of the function parameter traversal, step S27 is executed.

[0089] In this embodiment, the description of this step can refer to the description of the corresponding position in the first embodiment of the function analysis method, and will not be repeated here.

[0090] S27: Determine whether the expression of the referenced function is updated.

[0091] S28: In response to the update of the expression of the referenced function, recalculate the expression of the referenced function and update its calculation result.

[0092] In response to the expression of the referenced function not being updated, parsing of the function is complete.

[0093] S29: traverse the dependency list of the referenced function, and update the expressions and calculation results of all functions calculated after the referenced function.

[0094] In the process of calculating the function expression, the corresponding referenced function expression can be found through the reference parameter, and the calculation result of the referenced function expression can be directly returned to the calculation of the function expression, so as to realize the situation that the calculation of the function expression depends on the result of another function expression. Therefore, when the expression of the referenced function changes, its result needs to be updated so that the correct result of the referenced function can be called in the process of calculating the function expression.

[0095] If the expression of a function has multiple layers of reference relationships, when calculating it, the corresponding functions can be updated from the inside out according to the dependency list of the referenced functions to achieve the update of the outermost function.

[0096] For example, the function expressions FuncC(sheet1!C3,c1,c2), FuncB(sheet1!B3,b1,b2), FuncA(a1,a2), where the function FuncC references the result of the function FuncB, and the function FuncB references the result of the function FuncA, and FuncC is the outermost function. When parsing the function FuncC, add the reference index sheet1!C3 of the function FuncC to the dependency list of the function FuncB. When parsing the function FuncB, add the reference index sheet1!B3 of the function FuncB to the dependency list of the function FuncA. When calculating the function expression FuncC(sheet1!C3,c1,c2), first find FuncB(sheet1!B3,b1,b2) through sheet1!C3, and judge according to the dependency list of FuncB that FuncB takes precedence over FuncA for calculation, and continue through sheet1! B3 finds FuncA(a1, a2), and determines that FuncA is calculated before FuncB according to the dependency list of FuncA. Therefore, FuncA can be calculated first, and then the calculation result of FuncA is returned to calculate FuncB to obtain the calculation result of FuncB. Then the calculation result of FuncB is returned to calculate FuncC to obtain the calculation result of FuncC. When FuncA is updated, FuncB and FuncC can be updated in turn, so that the function can be updated from the inside out to obtain the correct calculation result.

[0097] The update process is that in the update list, the rule of performing calculations in the order of priority in the same row can be updated. Specifically, the rule of performing calculations in the order of priority in the first row is updated first, and then the rule of performing calculations in the order of priority in the first column is updated.

[0098] For example, see Figure 6 , the referenced function expression FuncA(a1,a2) is located at sheet1! B3, and the function expression FuncB(sheet1! B3,b1,b2) is located at sheet1! C3, that is, the expressions FuncA(a1,a2) and FuncB(sheet1! B3,b1,b2) are both located in the third row. In the order of priority FuncA being higher than FuncB, FuncA(a1,a2) is calculated first, and then FuncB(sheet1! B3,b1,b2) is calculated.

[0099] The update of the expression of the referenced function may be an update of the function parameter value or an update of the number of function parameters.

[0100] For example, see Figure 7 , Figure 7 It is a schematic diagram of two different updating methods of the referenced function in another embodiment of the function parsing method of the present application. The expression of the referenced function before updating is FuncA(a1, a2). Optionally, the expression of the referenced function can be updated to FuncA(a1, a3) or FuncA(a1, a2, a3). If the expression of the referenced function is updated to FuncA(a1, a3), the expression FuncA(a1, a3) of the referenced function is recalculated and its calculation result is updated to obtain the correct result after the update. The dependency list of the referenced function FuncA is traversed, and according to the pre-established priority relationship that the referenced function FuncA takes precedence over the function FuncB for calculation, the expressions and their calculation results of all functions calculated after the referenced function FuncA are updated, here is the expression and its calculation result of the updated function FuncB.

[0101] Different from the related art, this application can realize the automatic update of the expression of the function when the expression of the referenced function is updated during the calculation process by establishing a dependency list of the referenced function. For example, on a robot operation production line, there are two threads running different operations. When a line layer needs to call the result of another line layer as a parameter of the current line layer, the above method can improve the correctness of the call result.

[0102] Figure 8 FIG. 1 is a schematic diagram showing a structure of an embodiment of a computer device of the present application. Figure 8 The computer device 100 in the embodiment of the present application includes: a processor 101, a memory 102 and instructions stored therein. When the processor 101 executes the instructions, the steps of the method in any of the above embodiments are implemented.

[0103] The processor 101 may also be referred to as a CPU (Central Processing Unit). The processor 101 may also be an integrated circuit chip having signal processing capabilities. The processor 101 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0104] Different from the related art, the present application replaces the expression of the referenced function with a reference parameter so that the expression of the function can be organized; in response to the function parameter being a reference parameter, the reference index corresponding to the function is added to the dependency list of the referenced function corresponding to the reference parameter to establish a priority relationship in which the referenced function takes precedence over the function for calculation, thereby realizing the parsing of functions whose function parameters are expressions of other functions.

[0105] The above descriptions are merely embodiments of the present application and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A function analysis method, characterized in that: include: Parse the function expression to get the function parameters; Determine whether the function parameter is a reference parameter, the reference parameter represents an expression of the corresponding referenced function; In response to the function parameter being the reference parameter, adding the reference index corresponding to the function to the dependency list of the referenced function corresponding to the reference parameter, so as to establish a priority relationship in which the referenced function is calculated before the function; In response to the function parameter not being the reference parameter, putting the function parameter into a function parameter list; The step of adding the reference index corresponding to the function to the dependency list of the referenced function corresponding to the reference parameter in response to the function parameter being the reference parameter comprises: Put the function parameters into the function parameter list; The step of putting the function parameters into the function parameter list comprises: Determine whether the function parameter traversal is completed; In response to the incomplete traversal of the function parameters, returning to the step of parsing the function expression to obtain the function parameters.

2. The method according to claim 1, characterized in that The step of parsing the expression of the function includes: The expression of the function is filled in the update list having the function, wherein if the expression of the function has the reference parameter, a reference relationship between the function and the referenced function is established.

3. The method according to claim 2, characterized in that The reference parameter is the position number of the expression of the referenced function in the update list; the reference index is the position number of the expression of the function in the update list.

4. The method according to claim 2, characterized in that The step of adding the reference index corresponding to the function to the dependency list of the referenced function corresponding to the reference parameter comprises: Determine whether the expression of the referenced function is updated; In response to the update of the expression of the referenced function, the expression of the referenced function is recalculated and the calculation result thereof is updated.

5. The method according to claim 4, characterized in that The step of recalculating the expression of the referenced function and updating the calculation result thereof in response to the expression update of the referenced function comprises: The dependency list of the referenced function is traversed, and the expressions and calculation results of all the functions calculated after the referenced function are updated.

6. The method according to claim 2, characterized in that The update list is an electronic table, and the position numbers in the list are serial numbers of the electronic table.

7. A computer device, characterized in that: The method comprises a processor, a memory and instructions stored therein, wherein when the processor executes the instructions, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Systems and methods for compiler-based vectorization of non-leaf code

    CN103119561A

  • Implementing method for self-defined functions of reporting system

    CN104461531A