About 12 years ago or so, there was some interest on p5p to randomly generate Perl, or Perl-like code (both syntactically valid and invalid code) in order to stress test the compiler (IIRC, the main purpose was to locate cases where the compiler would crash). Generators based on Markov chains were written. (This was before PPI or any of the B:: modules). After some successes and time, interest waned.
Potential danger that needs to be addressed: you don't want to compile randomly generated code that may execute any of it. So, you don't want any BEGIN/CHECK/UNITCHECK block, and no use statements.