Flexible code generaor