Bagel code generator for qdp