We are using ANTLR v4 as the filter framework. The filter grammar is here:
I suggest you read up with ANTLR and play with it first if you are not familiar with it.
We are also using the ANTLR Visitor strategy and since we have LDAP as a backend, our visitors are specialized towards LDAP queries:
[SCIM filter visitors](https://github.com/GluuFederation/oxTrust/tree/master/server/src/main/java/org/gluu/oxtrust/service/antlr/scimFilter/visitor)