I am looking for code wchich parses prefix expressions using recursion. Primarily in C++, but it can bee in other language, i will translate. Thanks.
I am looking for code wchich parses prefix expressions using recursion. Primarily in C++,
Share
It’s really easy to do yourself (you just need a stack for the operators (and sometimes/optionally its first term)).
But if you really don’t want to do much work, here’s a link:
prefix notation string to int conversion
If you need to use recursion, you basically use local variables in the function as individual elements in your stack.
Eg. pseudo-C++ code follows:
You can convert the pseudocode to actual C++, and if you want, fix the global
naughtyglobalendindexvariable if you want.