Given a set S of n rules, I need an antlr4 rule to match any of S subset, in any order :
- each rule of S can appear zero or one time
- any permutation of the subset is ok
Example :
Given S = {a,b}, (n = 2) the rule must match
- a
- b
- a b
- b a
while "a b b", for instance must not match.
It is possible to parse such expression with an antlr4 grammar ? My real set has n = 6, so listing all combinations in the grammar seems not to be a possible choice !