I have the text content full of expressions like:
a = 1
d = b + c
b = a * c
c = 2 - a
...
This expressions may be written in random order. I can extract each of these expressions and evaluate each of them but I need to find optimal algorithm to avoid circular evaluations like:
a = 1
d = ? (skip)
b = ? (skip)
c = 2 - a = 1
...
d = ? (skip)
b = a * c = 1
...
d = b + c = 2
...
Is there the way "to order" the equations by the involved arguments to avoid extra calculation passes by like:
a = 1
c = 2 - a = 1
b = a * c = 1
d = b + c = 2
...
?