I will have a look. Also I forgot this repo [hydra](https://github.com/mratsim/hydra) which implements a constraint parser for constraint programming / integer linear programming:
[Example of syntax parsed](https://github.com/mratsim/hydra/blob/a9a6cb91279ec640f5f50ae4c8f695596b187afd/tests/test_sets.nim) [Parser](https://github.com/mratsim/hydra/blob/a9a6cb91279ec640f5f50ae4c8f695596b187afd/hydra/ilp/constraints.nim) It transforms a mathematical set notation into a sequence of [constraint objects described here](https://github.com/mratsim/hydra/blob/a9a6cb91279ec640f5f50ae4c8f695596b187afd/hydra/ilp/datatypes.nim#L77-L101). For example: With * S a named statement, * T and N being representing known constants, * i, j, t representing all the combination of values in the mathematical set `[T,N] -> { S[t,i] : 1<=t-i<T}` will be transformed into 2 constraints `@[t - i - 1 >= 0, T - t + i - 1 >= 0]` and `{ S[i,j] : 1<=i<=2 and 1<=j<=3 }` will be transformed into 4 constraints: `@[i - 1 >= 0, -i + 2 >= 0, j - 1 >= 0, -j + 3 >= 0]` Ultimately I have another conversion to matrix form: | 1 0 -1 | | -1 0 2 | | 0 1 -1 | | 0 -1 3 | Run And then this can be solved by a constraint solver/integer linear programming depending on your purpose: * nested for loop generation / polyhedral compiler (the original goal) * scheduling shifts in a restaurant or maintenance in a nuclear power plant * ...