For writing your own calculator (expression evaluator) for expressions like:
3+2*5
7+(8/2)*5
3*5+8*7
I'm under the impression that the only sensible way to accomplish this is to convert to either prefix notation or postfix notation, then evaluate from there.
I've done this before a while ago using postfix notation and it seemed to work pretty well. At the time I got the idea from somewhere (can't remember where at the moment) that postfix notation is more standard for this puspose. I've not tried this with prefix notation.
What are advantages/disadvantages of choosing prefix notation vs postfix notation for this task? For a typical interview question (ex. https://leetcode.com/problems/basic-calculator-ii/) what would be the better choice and why?
P.S. Does Python's eval use prefix, postfix, or an entirely different method? I'm under the impression that this is the source https://github.com/python/cpython/blob/master/Python/ceval.c for Python's eval but it's not very clear what the general strategy is.