# DSL Specification
## Grammar
The grammar is written in [EBNF](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form)
To not waste space in the grammar, we define some of the productions with words:
- `string`: A string as defined by [RFC8259](https://datatracker.ietf.org/doc/html/rfc8259#section-7)(JSON RFC). Except we don't support multiline strings.
- `alpha_lower`: Any lowercase ASCII alphabetic character (`a-z`)
- `digit`: A digit (`0-9`)
```ebnf
config = { definition } ;
rule = 'rule', identifier, '{', { rule_pair }, '}' ;
rule_pair = 'matcher', ':', matcher
| 'action', ':', action ;
matcher = and_matcher ;
not_matcher = 'not', msg_matcher | msg_matcher ;
msg_matcher = 'subject', string_matcher
| 'from', string_matcher
| 'to', string_matcher
| 'body', string_matcher
| '(', matcher, ')' ;
string_matcher
= 'contains', string
| 'startswith', string
| 'equals', string
| 'regex', string ;
match_list = '[', { matcher }, ']' ;
folder = 'folder', identifier, '{', { folder_pair }, '}' ;
folder_pair = 'name', ':', string ;
identifier = alpha-lower, { identifier1 } ;