I have a language where each type of symbol is only allowed a particular number of times, but the order isn’t important. For example, lets say there are three symbols $ a, b, c$ , and a valid string in the language consists of at most 5 $ a$ , 3 $ b$ and 2 $ c$ characters. So $ ababbc$ is valid, $ ccbbbaaaaa$ is valid, but $ abcabcabc$ is not. I’m struggling to come up with a grammar that satisfies such constraints without resorting to enumerating each possibility. Is it possible to have a concise set of rules that encode these constraints?