begin to gen code