Blake-Madden / tinyexpr-plusplus

Tiny recursive descent expression parser, compiler, and evaluation engine for math expressions and spreadsheet formulas in C++.

Home Page:https://blake-madden.github.io/tinyexpr-plusplus/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Extensions for rule engine

mincequi opened this issue · comments

Actually, I have the need for a rule engine and there might be some further requirements on the math parser:

Imagine the following TOML config file, that describes what I want to do:

[rules]
[rules.enableHeating]
when = "smartMeter1.power > 1900 AND sensor1.temperature < 52"
then = "heating1.powerControl = true"
[rules.disableHeating]
when = "smartMeter1.power < 300 OR sensor1.temperature > 55"
then = "heating1.powerControl = false"

So, my idea is, to read and assign properties of objects with the notation "objectName.propertyName".
Do you believe, that is feasible?

Thanks in advance.

Just checked in support for periods within functions and var names.

And the IF function (if you nest them) should provide the rules logic that you need.

Great to hear. Thanks a lot!