SYNTACTIC ANALYSIS OF ARITHMETIC EXPRESSIONS FOR OPTIMIZING THE OPERATION OF PROGRAMS

Autor: Maksym Peretiaha, Mykyta Poltavets, Kirill Smelyakov, Anastasia Chupryna
Rok vydání: 2023
Zdroj: Grail of Science. :215-229
ISSN: 2710-3056
DOI: 10.36074/grail-of-science.14.04.2023.039
Popis: Our algorithm combines the Reverse Polish Notation (RPN) and expression tree algorithms it is a novel method for efficiently evaluating arithmetic expressions. The algorithm combines the benefits of Reverse Polish Notation (RPN) and Expression Trees to provide a practical and efficient solution for evaluating expressions in both infix and postfix notation. The algorithm first converts the infix notation to RPN, which is then used to construct an expression tree. The expression tree is evaluated using a recursive function that traverses the tree and performs the required operations. The use of an expression tree allows for the optimization of sub-expressions, further improving the efficiency of the algorithm. The Combined RPN and Expression Tree Algorithm offers several advantages over other algorithms for evaluating arithmetic expressions. It is more efficient than some recursive algorithms while being more practical than stack-based algorithms. Furthermore, the use of an expression tree allows for the optimization of sub-expressions, further improving efficiency.
Databáze: OpenAIRE