In Delphi XE I have a routine that breaks down some complicated formulas to a binary formula result like this:
(1&((1|0)|1)&1)
Since my application is on SQL Server I can easily do a SELECT (1&((1|0)|1)&1) As Result and SQL Server will evaluate the logic to give me a 1 or 0 result.
I cannot seem to find a native Delphi way of taking a string representation of a binary formula and evaluating it.
I looked into the Live Bindings Evaluators added to XE but any attempt at the and/or operators throws parser errors so I believe that to be more of a mathematical process.
I also looked at a few parsers but none really seemed to jump out at me.
So how can I do something similar to:
iSomeInt := Evaluate('(1&((1|0)|1)&1)');
BTW.. I can totally rework the formula and use and/or instead of &|.. that was just to make it work with SQL Server.