A failed attempt at creating a Rules Engine DSL.
Recently for a Go project I needed something similar to https://www.drools.org/. I looked around and found a few with the general idea of rules matching: https://golanglibs.com/search?q=rules+engine. But didn't find anything which would allow us to express the complex rules logic we had. Naturally, I thought of creating my own DSL, but that didn't really fit the time frame.
After a bit of head banging, I decided to use the text/template package as a base to hack out a psuedo rules dsl. It worked out OK! But for a really complex business logic( am not at liberty to share it), the code became illegible and required a steep learning curve to understand it. This is not good for a business rules logic DSL since it needs to be understood by people with varied technical skills.
The resultant work is hosted at: https://github.com/myntra/roulette .
A typical rules file: https://github.com/myntra/roulette/blob/master/testrules/rules_advanced.xml
More rule files: https://github.com/myntra/roulette/tree/master/testrules.
Ultimately we decided to not use the roulette package and wrote the rules logic in pure Go instead(with a simple json file). It seems to me a full-fledged DSL like Drools : https://docs.jboss.org/drools/release/5.6.0.Final/drools-expert-docs/html_single/ can't be avoided. But before I go deep diving into ASTs, parsers and lexers, I thought I would go get feedback from r/golang, of ways to solve this problem or any existing work which I can reference to. Thanks in advance.
[edit: typos]