You ensure that n is len(what follows the command) or greater.
So (5xn)ADVENT is fine but as (5xn)ADVENT is of length 10, the smallest thing that can be included is (10xn)(5xn)ADVENT. Anything less is invalid
So to generate the input you cna basically reverse the grammar definition
text := [Expansion]?[text][text]?
Expansion := (Zxlen{following text}) where Y is the length of the following [text] and Z >1
buildtext :
text = null
loop until break:
text = text + random select:
(random integer x length of)buildtext
character in [A-Z]
break
return text
so text=buildtext will give you, for suitable random parameterisation, a valid compressed string.
- for given models of random