Given a mathematical expression, I would like to find out which are the parts that can be evaluated simultaneously. For example, given the following expression,
(a + b) * c - (d + e) / f
(a + b) and (d + e) could be evaluated simultaneously because they are independent of each other.
Is there any algorithm for this purpose?
Or is there even any library that implements this functionality?
This is a short and simple step by step manual for creating math parser.
After you have parsed the expression, and you hold a tree representing parsed expression, you can iterate over it, and in every iteration each pairs leaves of the tree will represent an independent expression (that can be evaluated simultaneously). [in every iteration replace the evaluated expressions with their result]
Building Expression Evaluator with Expression Trees in C#