in reply to Walking a boolean tree to produce matching inputs
Maybe see section 4.3.2 Genomic Sequence Generator of Dominus's Higher Order Perl (free download here) for something (at least remotely) like this.