generate dispatch table code