Adding Conditionals & Functions to a Math Parser
问题 I have a binary tree based mathematical expression parser I built, which works great for 'normal' math, like: (3.5 * 2) ^ 1 / (1 << 6) . however, I would like to expand it a little to add a ternary selection operator, mirroring the one from C: {expr} ? {true-expr} : {false-expr} . I would also like to add functions, like sin(x) or ave(...) . I however have no clue to how the handle this (due to the way the evaluation works), nor can I find anything on the web that covers this, atleast in a