Infer, a static analysis tool, has a DSL for declaring forbidden patterns: https://code.facebook.com/posts/277643589367408/ (it models ASTs with *temporal* logic!)