Using pyparsing I have the rules to parse a math expression with parenthesis (), +, -, * and /. The operations can be nested and the parser knows how to achieve that. Credit goes to PaulMcG.
The expression can have logical operations with iif
keyword this way:
iif(condition, value_if_true, value_if_false)
Condition has the regular operators =, >=, <=, >, <, <>, &, |
There is a way to calculate the result from a string expression. But I can not find a way to get the final value since the condition can have nested conditions.
So, is there any way to instruct pyparsing to calculate this final value using logic operations alonside math operations? Or there is any way to remove the conditions and return the original expression as single math expression and then be able to calculate the final value?
PS: I'm using python 3.6.7 and Linux Mint 19.1.