This question has already been answered:

Good day everyone!

To write a lab, an arithmetic parser is required. Maybe someone else lying around .cpp-Schnick? It is enough to recognize the basic arithmetic operations and a pair of functions (sin, cos, log).

Thank you in advance!

Reported as a duplicate by Abyx c ++ 3 Sep '17 at 18:40

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

    3 answers 3

    You will suit the reverse Polish entry . In the article by reference there is an example implementation in C. Here in c ++ . I found another implementation with a simple googling, but did not check it.

    • one
      Please note that it’s more logical to use the implementation on stacks here - Sergey

    Still it is necessary to dig towards generators of a code of a parcer (like yacc ).

      I do not think that you should deal with the reverse Polish notation and compiler theory right from the start (google the Dragon Book if necessary).

      I really liked the approach in this book:

      D. Crenshaw. Let's create a compiler

      Simple and affordable. After reading literally 1-2 chapters you write everything you need and also get information for further development (if you need it) ...