I previously made a toy VM where a program consisted of a matrix, rows corresponded to instruction slot, and then the values in that row were probabilities for different instructions.
This means probability of emitting a specific output is differentiable in the probabilities, which can then be learned.
Didn't get very good results though.