Using Delphi's Expressions Engine
Delphi RTL include a very powerful expression engine, which is one of the foundations of the Live Bindings architecture, but can be used as a separate engine for processing expressions. This blog post offers a quick introduction to the topic.
There are many hidden gems in the Delphi RTL. One of them is the expression engine. Recently I had some conversations with a long time Delphi developer who was looking for a similar feature, not realizing it has been in the product for many years. I knew I had written some demos and documentation so I spent a little time searching for them and I found a few. Now this topic is very complex and I won't be able to cover it in full, but for simple scenarios you really need very little code to parse and process an expression.
Before I start with the real topic I also wanted to mention we have recently surfaced this feature in the new VCL NumberBox component (added in Delphi 10.4.2, see for example https://blog.marcocantu.com/blog/2021-february-new-vcl-controls-1042.html). This component allows end users to enter an expression and replace it with the resulting value. No surprise it used the existing expression engine and it does by invoking a simplified class method of