Function Compilation Using Bracket Identifiers for Abstract Syntax Trees
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Computers struggle to identify and compile user-defined function logic under relevant syntax rules, leading to failures in function compilation.
Innovation Solution
A method and apparatus for function compilation that acquire an objective function, determine the function body and argument using a bracket identifier, compile the function into an abstract syntax tree, and obtain a computation result based on the tree.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If computers use conventional syntax rules for function identification, then standard functions can be compiled, but user-defined function logic cannot be identified and compiled
Solution Approach 1:
The patent introduces an intermediary parsing mechanism that acts as a mediator between user-defined function logic and the compilation system. By using bracket identifiers as delimiters and a specialized parser to recognize custom syntax patterns, the system can translate user-defined functions into a format compatible with existing compilation infrastructure, thus supporting versatility while maintaining compilation reliability
Solution Approach 2:
The patent changes the syntax parameters by introducing bracket identifiers as delimiters and allowing custom function definition patterns. This parameter change enables the compiler to recognize and process user-defined functions by transforming them into a standardized internal representation, resolving the contradiction between supporting new function types and maintaining reliable compilation
2Ease of operation
If the system supports flexible user-defined function creation, then user freedom increases, but the complexity of identifying and compiling these functions increases
Solution Approach 1:
The patent segments the function identification process into distinct phases: parsing the input string to locate bracket identifiers, extracting the function body and arguments, and validating against syntax rules. This segmentation allows the complex task of handling user-defined functions to be broken down into manageable steps, reducing overall system complexity while maintaining user flexibility
Solution Approach 2:
The parser serves as an intermediary layer that handles the complexity of syntax variation. By providing a dedicated parsing mechanism that translates diverse user inputs into a standardized internal format, the system shields users from compilation complexity while enabling flexible formula creation
Data Source
AI summary
The disclosure relates to a method and apparatus for function compilation, a medium, and an electronic device, and relates to the technical field of computers. According to the method, according to a bracket identifier in an objective function to be compiled, a function body in the objective function and an argument called by the function body are determined; the objective function is compiled into an abstract syntax tree according to the function body and the argument; a computation result corresponding to the objective function is obtained based on the abstract syntax tree; a formula text character string sequence input by a user can be accurately compiled into an abstract syntax tree having semantics; and further the computation result of the objective function is computed based on the abstract syntax tree having the semantics.


