4 ms·
I implemented this algorithm for a hobby project around five years ago. https://github.com/LoganDark/cpp-calculator/blob/315c3e9814e772ac063f698218842c2b2a1075
by LoganDark 3y ago
I implemented this algorithm for a hobby project around five years ago.
https://github.com/LoganDark/cpp-calculator/blob/315c3e9814e772ac063f698218842c2b2a10751b/CalcAST.cpp#L22-L223 https://github.com/LoganDark/cpp-calculator/blob/315c3e9814e...
It was sort of butchered to try to handle function calls as well, but it's still kind of shunting-yard. It also doesn't handle unary operators well. But it worked for its original purpose, I suppose.