Card Solver Compiler Parsing Reduces Computational Expense
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing compiler parsing algorithms, such as top-down operator precedence (TDOP), are computationally expensive due to their recursive nature, which hinders efficient processing and evaluation of formulas.
Innovation Solution
A non-recursive 'card game' mechanic is employed to parse tokens and generate outputs inserted into a tree data structure, where tokens are assigned precedence values and compared to determine capture, allowing for efficient bottom-up processing without recursion, and nodes can be routed to appropriate processors for parallelism.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If recursive-descent parsing algorithms (such as TDOP) are used, then parsing functionality is achieved, but computational expense increases
Solution Approach 1:
The parsing process is segmented into distinct phases: tokenization, precedence assignment, and iterative resolution. Each phase handles a specific aspect of parsing independently, avoiding the overhead of recursive function calls while maintaining comprehensive parsing functionality through systematic breakdown of the problem into manageable segments.
Solution Approach 2:
The patent replaces the mechanical recursive descent mechanism with an iterative card-game-inspired system using stacks and precedence comparisons. This substitution eliminates the computational overhead of recursion while preserving parsing capabilities through a fundamentally different mechanical approach based on iterative token comparison and stack-based state management.
2Reliability
If recursive parsing methods are employed, then comprehensive formula evaluation is achieved, but processing efficiency decreases
Solution Approach 1:
Tokens are pre-tokenized and assigned precedence values before the main parsing logic executes. This preliminary action organizes the input data into a structured format with embedded precedence information, enabling the subsequent iterative parsing to proceed efficiently without requiring backtracking or repeated analysis, thus maintaining completeness while improving speed.
Solution Approach 2:
The iterative parsing mechanism maintains continuous useful action by systematically processing tokens in a single pass through the formula. The use of stacks ensures that each token is examined and resolved exactly once in the appropriate order, eliminating the repeated processing and backtracking inherent in recursive methods, thereby achieving both completeness and efficiency.
3Measurement precision
If traditional recursive algorithms are used, then parsing accuracy is maintained, but computational time increases
Solution Approach 1:
The patent changes the fundamental parameter of the parsing approach from recursive depth-first traversal to iterative precedence-based processing. By assigning and comparing precedence values as a primary parameter, the system achieves accurate parsing results through a more time-efficient mechanism that processes tokens in a single systematic pass rather than through multiple recursive iterations.
Solution Approach 2:
The patent creates a copy of each token with its precedence value attached, forming an enriched token representation. This copying approach allows the parsing algorithm to work with pre-labeled tokens that encode their processing priority, eliminating the need for repeated analysis and ensuring accurate results are obtained in a single efficient pass through the data.
Data Source
AI summary
Disclosed herein is a compiler parsing technique that makes use of a “card game” mechanic to parse through tokens and generate an output that is inserted into a tree data structure and processed bottom-up. The technique is a non-recursive a parser & lexer. The processing is less computationally expensive than prior, recursive methods such as top down operator precedence. Simpler embodiments employ card solving of simple formulas, and more advanced embodiments implement tree processing structures that implement a card solver parsing technique at each node (or a subset of nodes) of the tree processing structures. In some embodiments, different nodes of a tree processing structure are routed to different processors (e.g., a CPU or a GPU) based on the degree of parallelism available in each node in order to improve parsing, compute, evaluation and compiling times.


