A failed attempt at creating a Rules Engine DSL.

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: http://ift.tt/2u3zvyo. 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: http://ift.tt/2tkQEqc .

A typical rules file: http://ift.tt/2u3OF6K

More rule files: http://ift.tt/2tlmUJN.

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 : http://ift.tt/2u3c5cu 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]

Submitted July 18, 2017 at 12:19PM by 3bodyproblemsolver
via reddit http://ift.tt/2uDlWJh


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s